Add overall code reformatting
This commit is contained in:
parent
93d5fec51a
commit
6654cf857e
12 changed files with 248 additions and 212 deletions
|
@ -44,13 +44,18 @@ make.network = {
|
||||||
random.pick([random.number(255), make.numbers.number]);
|
random.pick([random.number(255), make.numbers.number]);
|
||||||
},
|
},
|
||||||
randomIPv6: function () {
|
randomIPv6: function () {
|
||||||
return "[" + make.stringFromBlocks([":", function() { return make.strings.digitsHex(random.range(1, 4)) }]) + "]"
|
return "[" + make.stringFromBlocks([":", function () {
|
||||||
|
return make.strings.digitsHex(random.range(1, 4))
|
||||||
|
}]) + "]"
|
||||||
},
|
},
|
||||||
goodHostnames: function() { return [
|
goodHostnames: function () {
|
||||||
|
return [
|
||||||
"0.0.0.0",
|
"0.0.0.0",
|
||||||
"127.0.0.1:8080",
|
"127.0.0.1:8080",
|
||||||
]},
|
]
|
||||||
badHostnames: function() { return [
|
},
|
||||||
|
badHostnames: function () {
|
||||||
|
return [
|
||||||
"google.org:8080",
|
"google.org:8080",
|
||||||
"::1",
|
"::1",
|
||||||
"[::192.9.5.5]:42",
|
"[::192.9.5.5]:42",
|
||||||
|
@ -62,7 +67,8 @@ make.network = {
|
||||||
"::ffff:192.0.2.128",
|
"::ffff:192.0.2.128",
|
||||||
"2001:db8::1:2",
|
"2001:db8::1:2",
|
||||||
"2001:db8::1:1:1:1:1"
|
"2001:db8::1:1:1:1:1"
|
||||||
]},
|
]
|
||||||
|
},
|
||||||
randomBitmask: function (list) {
|
randomBitmask: function (list) {
|
||||||
if (list.length <= 1) {
|
if (list.length <= 1) {
|
||||||
return list.join("");
|
return list.join("");
|
||||||
|
|
|
@ -6,15 +6,24 @@ make.numbers = {
|
||||||
let n;
|
let n;
|
||||||
if (random.chance(32)) {
|
if (random.chance(32)) {
|
||||||
switch (random.number(4)) {
|
switch (random.number(4)) {
|
||||||
case 0: n = random.range(Number.MAX_VALUE, Number.MIN_VALUE); break;
|
case 0:
|
||||||
case 1: n = Math.pow(10, 1) / Math.pow(10, random.number(307)); break;
|
n = random.range(Number.MAX_VALUE, Number.MIN_VALUE);
|
||||||
case 2: n = Math.pow(2, random.float() * random.float() * 64); break;
|
break;
|
||||||
case 3: n = Math.pow(10, random.range(1, 9)) / Math.pow(10, random.range(1, 9)); break;
|
case 1:
|
||||||
|
n = Math.pow(10, 1) / Math.pow(10, random.number(307));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
n = Math.pow(2, random.float() * random.float() * 64);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
n = Math.pow(10, random.range(1, 9)) / Math.pow(10, random.range(1, 9));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
switch (random.number(6)) {
|
switch (random.number(6)) {
|
||||||
default: n = random.float();
|
default:
|
||||||
|
n = random.float();
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
},
|
},
|
||||||
|
|
54
make/text.js
54
make/text.js
|
@ -96,7 +96,8 @@ make.text = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// http://www.unicode.org/Public/6.0.0/ucd/UnicodeData.txt
|
// http://www.unicode.org/Public/6.0.0/ucd/UnicodeData.txt
|
||||||
unicodeCombiningCharacters: function() { return random.item([
|
unicodeCombiningCharacters: function () {
|
||||||
|
return random.item([
|
||||||
[0x0300, 0x036F], // Combining Diacritical Marks
|
[0x0300, 0x036F], // Combining Diacritical Marks
|
||||||
[0x0483, 0x0489],
|
[0x0483, 0x0489],
|
||||||
[0x07EB, 0x07F3],
|
[0x07EB, 0x07F3],
|
||||||
|
@ -115,29 +116,39 @@ make.text = {
|
||||||
[0x1D17B, 0x1D18B],
|
[0x1D17B, 0x1D18B],
|
||||||
[0x1D1AA, 0x1D1AD],
|
[0x1D1AA, 0x1D1AD],
|
||||||
[0x1D242, 0x1D244]
|
[0x1D242, 0x1D244]
|
||||||
])},
|
])
|
||||||
unicodeBMP: function() { return random.item([
|
},
|
||||||
|
unicodeBMP: function () {
|
||||||
|
return random.item([
|
||||||
// BMP = Basic Multilingual Plane
|
// BMP = Basic Multilingual Plane
|
||||||
[0x0000, 0xFFFF]
|
[0x0000, 0xFFFF]
|
||||||
])},
|
])
|
||||||
unicodeSMP: function() { return random.item([
|
},
|
||||||
|
unicodeSMP: function () {
|
||||||
|
return random.item([
|
||||||
// SMP = Supplementary Multilingual Plane
|
// SMP = Supplementary Multilingual Plane
|
||||||
[0x10000, 0x13FFF],
|
[0x10000, 0x13FFF],
|
||||||
[0x16000, 0x16FFF],
|
[0x16000, 0x16FFF],
|
||||||
[0x1B000, 0x1BFFF],
|
[0x1B000, 0x1BFFF],
|
||||||
[0x1D000, 0x1DFFF],
|
[0x1D000, 0x1DFFF],
|
||||||
[0x1F000, 0x1FFFF]
|
[0x1F000, 0x1FFFF]
|
||||||
])},
|
])
|
||||||
unicodeSIP: function() { return random.item([
|
},
|
||||||
|
unicodeSIP: function () {
|
||||||
|
return random.item([
|
||||||
// SIP = Supplementary Ideographic Plane
|
// SIP = Supplementary Ideographic Plane
|
||||||
[0x20000, 0x2BFFF],
|
[0x20000, 0x2BFFF],
|
||||||
[0x2F000, 0x2FFFF]
|
[0x2F000, 0x2FFFF]
|
||||||
])},
|
])
|
||||||
unicodeSSP: function() { return random.item([
|
},
|
||||||
|
unicodeSSP: function () {
|
||||||
|
return random.item([
|
||||||
// SSP = Supplementary Special-purpose Plane
|
// SSP = Supplementary Special-purpose Plane
|
||||||
[0xE0000, 0xE0FFF]
|
[0xE0000, 0xE0FFF]
|
||||||
])},
|
])
|
||||||
registeredFontFeatures: function() { return random.pick([
|
},
|
||||||
|
registeredFontFeatures: function () {
|
||||||
|
return random.pick([
|
||||||
'aalt', 'abvf', 'abvm', 'abvs', 'afrc', 'akhn', 'blwf', 'blwm', 'blws',
|
'aalt', 'abvf', 'abvm', 'abvs', 'afrc', 'akhn', 'blwf', 'blwm', 'blws',
|
||||||
'calt', 'case', 'ccmp', 'cfar', 'cjct', 'clig', 'cpct', 'cpsp', 'cswh',
|
'calt', 'case', 'ccmp', 'cfar', 'cjct', 'clig', 'cpct', 'cpsp', 'cswh',
|
||||||
'curs', 'cv01-cv99', 'c2pc', 'c2sc', 'dist', 'dlig', 'dnom', 'expt',
|
'curs', 'cv01-cv99', 'c2pc', 'c2sc', 'dist', 'dlig', 'dnom', 'expt',
|
||||||
|
@ -153,16 +164,23 @@ make.text = {
|
||||||
'ss14', 'ss15', 'ss16', 'ss17', 'ss18', 'ss19', 'ss20', 'subs', 'sups',
|
'ss14', 'ss15', 'ss16', 'ss17', 'ss18', 'ss19', 'ss20', 'subs', 'sups',
|
||||||
'swsh', 'titl', 'tjmo', 'tnam', 'tnum', 'trad', 'twid', 'unic', 'valt',
|
'swsh', 'titl', 'tjmo', 'tnam', 'tnum', 'trad', 'twid', 'unic', 'valt',
|
||||||
'vatu', 'vert', 'vhal', 'vjmo', 'vkna', 'vkrn', 'vpal', 'vrt2', 'zero'
|
'vatu', 'vert', 'vhal', 'vjmo', 'vkna', 'vkrn', 'vpal', 'vrt2', 'zero'
|
||||||
])},
|
])
|
||||||
assignmentOperator: function() { return random.pick([
|
},
|
||||||
|
assignmentOperator: function () {
|
||||||
|
return random.pick([
|
||||||
"=", "-=", "+=", "*=", "/="
|
"=", "-=", "+=", "*=", "/="
|
||||||
])},
|
])
|
||||||
arithmeticOperator: function() { return random.pick([
|
},
|
||||||
|
arithmeticOperator: function () {
|
||||||
|
return random.pick([
|
||||||
"%", "-", "+", "*", "/"
|
"%", "-", "+", "*", "/"
|
||||||
])},
|
])
|
||||||
currency: function() { return random.pick([
|
},
|
||||||
|
currency: function () {
|
||||||
|
return random.pick([
|
||||||
// https://en.wikipedia.org/wiki/ISO_4217
|
// https://en.wikipedia.org/wiki/ISO_4217
|
||||||
"USD", "USS", "USN", "EUR", "CHF", "GBP", "XAG", "XBA", "XBB", "XBC",
|
"USD", "USS", "USN", "EUR", "CHF", "GBP", "XAG", "XBA", "XBB", "XBC",
|
||||||
"XBD", "XSU", "XTS", "XXX",
|
"XBD", "XSU", "XTS", "XXX",
|
||||||
])},
|
])
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,15 +9,15 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function MersenneTwister()
|
function MersenneTwister() {
|
||||||
{
|
|
||||||
const N = 624;
|
const N = 624;
|
||||||
const M = 397;
|
const M = 397;
|
||||||
const UPPER_MASK = 0x80000000;
|
const UPPER_MASK = 0x80000000;
|
||||||
const LOWER_MASK = 0x7fffffff;
|
const LOWER_MASK = 0x7fffffff;
|
||||||
const MAG01 = new Int32Array([0, 0x9908b0df]);
|
const MAG01 = new Int32Array([0, 0x9908b0df]);
|
||||||
|
|
||||||
let mt = new Int32Array(N); /* the array for the state vector */
|
let mt = new Int32Array(N);
|
||||||
|
/* the array for the state vector */
|
||||||
let mti = 625;
|
let mti = 625;
|
||||||
|
|
||||||
this.seed = function (s) {
|
this.seed = function (s) {
|
||||||
|
|
|
@ -85,13 +85,16 @@ utils.script = {
|
||||||
return "(document.body || document.documentElement).appendChild" + utils.script..methodHead([name]);
|
return "(document.body || document.documentElement).appendChild" + utils.script..methodHead([name]);
|
||||||
},
|
},
|
||||||
forceGC: function () {
|
forceGC: function () {
|
||||||
if (platform.isMozilla) {}
|
if (platform.isMozilla) {
|
||||||
|
}
|
||||||
if (platform.isChrome) {
|
if (platform.isChrome) {
|
||||||
if (window.GCController)
|
if (window.GCController)
|
||||||
return GCController.collect();
|
return GCController.collect();
|
||||||
}
|
}
|
||||||
if (platform.isSafari) {}
|
if (platform.isSafari) {
|
||||||
if (platform.isIE) {}
|
}
|
||||||
|
if (platform.isIE) {
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getRandomElement: function () {
|
getRandomElement: function () {
|
||||||
return "document.getElementsByTagName('*')[" + random.number(document.getElementsByTagName("*").length) + "]";
|
return "document.getElementsByTagName('*')[" + random.number(document.getElementsByTagName("*").length) + "]";
|
||||||
|
|
Loading…
Reference in a new issue