https://www.coder.work/article/3779797
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| const shuffle = ([...array]) => {
let i = 0;
let j = 0;
let temp = null;
for (i = array.length - 1; i > 0; i -= 1) {
j = Math.floor(Math.random() * (i + 1));
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
return array;
}
id2nos = shuffle(id2nos);
|