Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/samualtnorman/lib. A collection of common utilities I need. www.npmjs.com/package/@samual/lib
Something went wrong. Try again.
123456789101112131415export function shuffle<T>(array: T[]): T[] { let index = array.length
while (index) { const randomIndex = Math.floor(Math.random() * index) const randomItem = array[randomIndex]!
index-- array[randomIndex] = array[index]! array[index] = randomItem }
return array}