mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-03 08:15:00 -05:00
14 lines
242 B
JavaScript
14 lines
242 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
|