X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Futils%2Falea.js;h=1f1d1460180ac6f5de9c61b47061de99827c37ba;hb=e727fe31742dfb3e40eb222c94f4199e2be98453;hp=9ff11593586a0a099d64f95ba919a91dfb4236ec;hpb=2a8a94c9e539319c76c0a72967b39f2e7e7b279e;p=vchess.git diff --git a/client/src/utils/alea.js b/client/src/utils/alea.js index 9ff11593..1f1d1460 100644 --- a/client/src/utils/alea.js +++ b/client/src/utils/alea.js @@ -22,9 +22,7 @@ export function sample(arr, n) { let cpArr = arr.map(e => e); for (let index = 0; index < n; index++) { const rand = randInt(index, arr.length); - const temp = cpArr[index]; - cpArr[index] = cpArr[rand]; - cpArr[rand] = temp; + [ cpArr[index], cpArr[rand] ] = [ cpArr[rand], cpArr[index] ]; } return cpArr.slice(0, n); }