X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Futils%2Falea.js;h=04563938ce091bd789c7d89dfd550bdda1594141;hp=76d9c38ecf0d47075a90d33a53f762fdba3d0b22;hb=656b187886e5187e52fafe44b7dc0fb45ccd9222;hpb=ab6f48ea4d9c549830f549f077c597f57ea4a57d diff --git a/client/src/utils/alea.js b/client/src/utils/alea.js index 76d9c38e..04563938 100644 --- a/client/src/utils/alea.js +++ b/client/src/utils/alea.js @@ -5,7 +5,7 @@ export function getRandString() .toUpperCase(); } -export function random (min, max) +export function randInt(min, max) { if (!max) { @@ -22,7 +22,7 @@ export function sample (arr, n) let cpArr = arr.map(e => e); for (let index = 0; index < n; index++) { - const rand = random(index, n); + const rand = randInt(index, arr.length); const temp = cpArr[index]; cpArr[index] = cpArr[rand]; cpArr[rand] = temp;