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 () {
return random.subset([
'*', '#',
'A', 'B', 'C', 'D',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
], make.number.range()).join('')
let count = make.number.range()
const values = []
while (count--) {
values.push(random.item(['*', '#', 'A', 'B', 'C', 'D', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']))
}
return values.join('')
}
static goodHostnames () {

View file

@ -72,7 +72,7 @@ class webgl extends make {
static parseUniforms (shader, group = 1) {
/* 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) {
@ -90,7 +90,7 @@ class webgl extends make {
static parseFragDatav3 (shader, group = 1) {
// #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) {
@ -102,7 +102,12 @@ class webgl extends make {
}
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) {