From 625adebc67d96ef9c07add00cd75dd09d8679b39 Mon Sep 17 00:00:00 2001 From: pyoor Date: Thu, 26 Jul 2018 19:26:57 -0400 Subject: [PATCH] Fix uses of random.subset --- lib/make/network.js | 12 +++++++----- lib/make/webgl.js | 11 ++++++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/make/network.js b/lib/make/network.js index 505d6c8..ce4e233 100644 --- a/lib/make/network.js +++ b/lib/make/network.js @@ -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 () { diff --git a/lib/make/webgl.js b/lib/make/webgl.js index 14e2400..6a4cce0 100644 --- a/lib/make/webgl.js +++ b/lib/make/webgl.js @@ -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) {