From 0f847430195f9ef8bf7666e83e8a11ad573c27ed Mon Sep 17 00:00:00 2001 From: BRNSystems <70092437+BRNSystems@users.noreply.github.com> Date: Sun, 16 Jan 2022 19:53:05 +0100 Subject: [PATCH] standalone rng for all grids --- index.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index da0730c..4d51304 100644 --- a/index.js +++ b/index.js @@ -72,12 +72,16 @@ function randomizetable(){ for (let j = 0; j < h; j++) { let r = Math.floor(Math.random() * 2); if (r == 0) { - lgrid[i][j] = x; rgrid[i][j] = o; } else { - lgrid[i][j] = o; rgrid[i][j] = x; } + r = Math.floor(Math.random() * 2); + if (r == 0) { + lgrid[i][j] = o; + } else { + lgrid[i][j] = x; + } } } } @@ -87,12 +91,16 @@ function randomizeaux(){ for (let j = 0; j < haux; j++) { let r = Math.floor(Math.random() * 2); if (r == 0) { - lauxgrid[i][j] = x; rauxgrid[i][j] = o; } else { - lauxgrid[i][j] = o; rauxgrid[i][j] = x; } + r = Math.floor(Math.random() * 2); + if (r == 0) { + lauxgrid[i][j] = o; + } else { + lauxgrid[i][j] = x; + } } } }