slick-connections.pages.sei.../src/utils.ts
2025-04-01 19:55:09 -07:00

8 lines
241 B
TypeScript

export function shuffleArray<T>(array: T[]) {
const copy = Array.from(array)
for (let i = copy.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[copy[i], copy[j]] = [copy[j], copy[i]];
}
return copy
}