sendou.ink/old/utils/shuffleArray.js
Kalle (Sendou) 1576f89925 move to old
2020-10-13 14:27:02 +03:00

14 lines
249 B
JavaScript

//https://stackoverflow.com/a/6274381
function shuffle(a) {
var j, x, i;
for (i = a.length - 1; i > 0; i--) {
j = Math.floor(Math.random() * (i + 1));
x = a[i];
a[i] = a[j];
a[j] = x;
}
return a;
}
module.exports = shuffle;