2
0
mirror of synced 2025-02-24 12:08:10 +00:00

12 lines
288 B
JavaScript
Raw Normal View History

"use strict";
export function shuffled(array) {
array = array.slice();
for (let i = array.length - 1; i > 0; i--) {
2019-11-20 18:57:38 +09:00
const j = Math.floor(Math.random() * (i + 1));
const tmp = array[i];
array[i] = array[j];
array[j] = tmp;
}
return array;
}