maplist when generating matches

This commit is contained in:
Kalle (Sendou)
2021-01-26 00:24:10 +02:00
parent c6f4574c69
commit e65d08a30e
3 changed files with 54 additions and 15 deletions

6
lib/shuffleArray.ts Normal file
View File

@@ -0,0 +1,6 @@
export const shuffleArray = (array: string[]) => {
return array
.map((a) => ({ sort: Math.random(), value: a }))
.sort((a, b) => a.sort - b.sort)
.map((a) => a.value);
};