mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-10 20:30:53 -05:00
7 lines
183 B
TypeScript
7 lines
183 B
TypeScript
export const shuffleArray = <T>(array: T[]) => {
|
|
return array
|
|
.map((a) => ({ sort: Math.random(), value: a }))
|
|
.sort((a, b) => a.sort - b.sort)
|
|
.map((a) => a.value);
|
|
};
|