jbilcke-hf's picture
jbilcke-hf HF staff
add array shuffle
2898d65
raw
history blame
224 Bytes
export const shuffleArray = (items: any[]) => {
for (let i = items.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
const temp = items[i];
items[i] = items[j];
items[j] = temp;
}
}