projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix games ordering in MyGames, fix en-passant mistake in Rifle variant
[vchess.git]
/
client
/
src
/
utils
/
alea.js
diff --git
a/client/src/utils/alea.js
b/client/src/utils/alea.js
index
9ff1159
..
1f1d146
100644
(file)
--- 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);
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);
}
}
return cpArr.slice(0, n);
}