Fix uses of random.subset

This commit is contained in:
pyoor 2018-07-26 19:26:57 -04:00
parent 075fe89309
commit 625adebc67
2 changed files with 15 additions and 8 deletions

View File

@ -141,11 +141,13 @@ class network extends make {
} }
static dtmf () { static dtmf () {
return random.subset([ let count = make.number.range()
'*', '#', const values = []
'A', 'B', 'C', 'D', while (count--) {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9' values.push(random.item(['*', '#', 'A', 'B', 'C', 'D', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']))
], make.number.range()).join('') }
return values.join('')
} }
static goodHostnames () { static goodHostnames () {

View File

@ -72,7 +72,7 @@ class webgl extends make {
static parseUniforms (shader, group = 1) { static parseUniforms (shader, group = 1) {
/* Todo: Parse their individual data types into categories. */ /* Todo: Parse their individual data types into categories. */
return webgl.match(shader, /uniform .+? (\w+)(?=[\[;])/gm, group) /* eslint-disable-line no-useless-escape */ return webgl.match(shader, /uniform .+? (\w+)(?=[\[;])/gm, group) // eslint-disable-line no-useless-escape
} }
static parseAttributes (shader, group = 1) { static parseAttributes (shader, group = 1) {
@ -90,7 +90,7 @@ class webgl extends make {
static parseFragDatav3 (shader, group = 1) { static parseFragDatav3 (shader, group = 1) {
// #version 300 // #version 300
return webgl.match(shader, /out .+? (\w+)(?=[\[;])/gm, group) /* eslint-disable-line no-useless-escape */ return webgl.match(shader, /out .+? (\w+)(?=[\[;])/gm, group) // eslint-disable-line no-useless-escape
} }
static parseFrag (shader, group = 1) { static parseFrag (shader, group = 1) {
@ -102,7 +102,12 @@ class webgl extends make {
} }
static randomBitmask () { static randomBitmask () {
return parseInt((random.subset([1, 0], 8).join(''))) const values = []
for (let i = 0; i < 8; i++) {
values.push(random.item([1, 0]))
}
return parseInt(values.join(''))
} }
static randomBufferTarget (isWebGL2) { static randomBufferTarget (isWebGL2) {