Shuffle
1 min read
Description
Shuffles an array in-place using the Fisher-Yates shuffle algorithm. This function randomly rearranges the elements of an array and returns the same array (mutated). It provides a uniform distribution, meaning each possible permutation has an equal probability of occurring.
Code
export const shuffle = <T>(arr: T[]): T[] => {
let i = arr