Remove Number suffix from make.number.* methods

This commit is contained in:
Christoph Diehl 2017-06-10 05:51:41 +02:00
parent 97bc2ab4ad
commit bf19096239

View file

@ -31,26 +31,26 @@ make.number = {
} }
return n return n
}, },
rangeNumber: function () { range: function () {
return random.pick([1, 2, 3, 4, 6, 8, 16, 32, 64, make.number.tinyNumber]) return random.pick([1, 2, 3, 4, 6, 8, 16, 32, 64, make.number.tiny])
}, },
tinyNumber: function () { tiny: function () {
return Math.pow(2, random.number(12)) return Math.pow(2, random.number(12))
}, },
unsignedNumber: function () { unsigned: function () {
if (random.chance(2)) { if (random.chance(2)) {
return Math.abs(make.number.any()) return Math.abs(make.number.any())
} }
return Math.pow(2, random.number(65)) + random.number(3) - 1 return Math.pow(2, random.number(65)) + random.number(3) - 1
}, },
evenNumber: function (number) { even: function (number) {
return number % 2 === 1 ? ++number : number return number % 2 === 1 ? ++number : number
}, },
any: function () { any: function () {
let value = random.choose([ let value = random.choose([
[10, make.number.float], [10, make.number.float],
[10, [make.number.rangeNumber, make.number.tinyNumber]], [10, [make.number.range, make.number.tiny]],
[1, make.number.unsignedNumber] [1, make.number.unsigned]
]) ])
return random.chance(10) ? -value : value return random.chance(10) ? -value : value
} }