Rename make.numbers to make.number
This commit is contained in:
parent
9869c32457
commit
aa6e9f567a
7 changed files with 17 additions and 17 deletions
|
@ -5,7 +5,7 @@
|
||||||
make.arrays = {
|
make.arrays = {
|
||||||
filledArray: function (fn, limit) {
|
filledArray: function (fn, limit) {
|
||||||
let array = [];
|
let array = [];
|
||||||
let size = limit || random.number(make.numbers.tinyNumber);
|
let size = limit || random.number(make.number.tinyNumber);
|
||||||
|
|
||||||
for (let i = 0; i < size; i++) {
|
for (let i = 0; i < size; i++) {
|
||||||
array.push(fn());
|
array.push(fn());
|
||||||
|
|
|
@ -29,7 +29,7 @@ make.font = {
|
||||||
/* <relative-size> values */
|
/* <relative-size> values */
|
||||||
["larger", "smaller"],
|
["larger", "smaller"],
|
||||||
/* <length> values */
|
/* <length> values */
|
||||||
make.numbers.unsignedNumber() + make.units.units(),
|
make.number.unsignedNumber() + make.units.units(),
|
||||||
/* <percentage> values */
|
/* <percentage> values */
|
||||||
make.units.percent(),
|
make.units.percent(),
|
||||||
]);
|
]);
|
||||||
|
@ -59,7 +59,7 @@ make.font = {
|
||||||
s += random.pick(make.font.weight) + " ";
|
s += random.pick(make.font.weight) + " ";
|
||||||
}
|
}
|
||||||
if (random.chance(4)) {
|
if (random.chance(4)) {
|
||||||
s += make.numbers.any() + "/";
|
s += make.number.any() + "/";
|
||||||
}
|
}
|
||||||
s += make.font.size();
|
s += make.font.size();
|
||||||
s += " ";
|
s += " ";
|
||||||
|
|
|
@ -42,10 +42,10 @@ make.network = {
|
||||||
return ["turn", "turns", "stun", "stuns"];
|
return ["turn", "turns", "stun", "stuns"];
|
||||||
},
|
},
|
||||||
randomIPv4: function () {
|
randomIPv4: function () {
|
||||||
return random.pick([random.number(255), make.numbers.any]) + "." +
|
return random.pick([random.number(255), make.number.any]) + "." +
|
||||||
random.pick([random.number(255), make.numbers.any]) + "." +
|
random.pick([random.number(255), make.number.any]) + "." +
|
||||||
random.pick([random.number(255), make.numbers.any]) + "." +
|
random.pick([random.number(255), make.number.any]) + "." +
|
||||||
random.pick([random.number(255), make.numbers.any]);
|
random.pick([random.number(255), make.number.any]);
|
||||||
},
|
},
|
||||||
randomIPv6: function () {
|
randomIPv6: function () {
|
||||||
return "[" + make.strings.stringFromBlocks([":", function () {
|
return "[" + make.strings.stringFromBlocks([":", function () {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
make.numbers = {
|
make.number = {
|
||||||
bool: function () {
|
bool: function () {
|
||||||
return random.bool();
|
return random.bool();
|
||||||
},
|
},
|
||||||
|
@ -32,14 +32,14 @@ make.numbers = {
|
||||||
return n;
|
return n;
|
||||||
},
|
},
|
||||||
rangeNumber: function () {
|
rangeNumber: function () {
|
||||||
return random.pick([1, 2, 3, 4, 6, 8, 16, 32, 64, make.numbers.tinyNumber]);
|
return random.pick([1, 2, 3, 4, 6, 8, 16, 32, 64, make.number.tinyNumber]);
|
||||||
},
|
},
|
||||||
tinyNumber: function () {
|
tinyNumber: function () {
|
||||||
return Math.pow(2, random.number(12));
|
return Math.pow(2, random.number(12));
|
||||||
},
|
},
|
||||||
unsignedNumber: function () {
|
unsignedNumber: function () {
|
||||||
if (random.chance(2)) {
|
if (random.chance(2)) {
|
||||||
return Math.abs(make.numbers.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;
|
||||||
},
|
},
|
||||||
|
@ -48,9 +48,9 @@ make.numbers = {
|
||||||
},
|
},
|
||||||
anynumber: function () {
|
anynumber: function () {
|
||||||
let value = random.choose([
|
let value = random.choose([
|
||||||
[10, make.numbers.float],
|
[10, make.number.float],
|
||||||
[10, [make.numbers.rangeNumber, make.numbers.tinyNumber]],
|
[10, [make.number.rangeNumber, make.number.tinyNumber]],
|
||||||
[1, make.numbers.unsignedNumber]
|
[1, make.number.unsignedNumber]
|
||||||
]);
|
]);
|
||||||
return random.chance(10) ? -value : value;
|
return random.chance(10) ? -value : value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ make.strings = {
|
||||||
let s = "";
|
let s = "";
|
||||||
|
|
||||||
if (maxlen == null || maxlen === undefined) {
|
if (maxlen == null || maxlen === undefined) {
|
||||||
maxlen = make.numbers.rangeNumber();
|
maxlen = make.number.rangeNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < maxlen; i++) {
|
for (let i = 0; i < maxlen; i++) {
|
||||||
|
|
|
@ -9,9 +9,9 @@ make.unit = {
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
length: function () {
|
length: function () {
|
||||||
return make.numbers.any() + make.unit.units();
|
return make.number.any() + make.unit.units();
|
||||||
},
|
},
|
||||||
percent: function () {
|
percent: function () {
|
||||||
return make.numbers.any() + "%";
|
return make.number.any() + "%";
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -64,7 +64,7 @@ utils.script = {
|
||||||
return "try { " + s + " } catch(e) { }";
|
return "try { " + s + " } catch(e) { }";
|
||||||
},
|
},
|
||||||
makeLoop: function (s, max) {
|
makeLoop: function (s, max) {
|
||||||
return "for (var i = 0; i < " + (max || make.numbers.rangeNumber()) + "; i++) {" + s + "}";
|
return "for (var i = 0; i < " + (max || make.number.rangeNumber()) + "; i++) {" + s + "}";
|
||||||
},
|
},
|
||||||
makeArray: function (type, arrayLength, cb) {
|
makeArray: function (type, arrayLength, cb) {
|
||||||
if (type == null || type === undefined) {
|
if (type == null || type === undefined) {
|
||||||
|
|
Loading…
Reference in a new issue