15 lines
332 B
TypeScript
15 lines
332 B
TypeScript
export const fshuffle = (list: any[]): any[] => {
|
|
var i, j, x;
|
|
for (i=list.length; i; i-=1) {
|
|
j = Math.floor(Math.random()*i);
|
|
x = list[i-1];
|
|
list[i-1] = list[j];
|
|
list[j] = x;
|
|
}
|
|
return list;
|
|
}
|
|
|
|
export const shuffle = (list: any[]): any[] => {
|
|
for (let z=0; z<5; z++) list = fshuffle(list);
|
|
return list;
|
|
} |