How to Shuffle a JavaScript Array using the Fisher-Yates (also known as Knuth)

5 months ago
4

This illustration defines a shuffleArray function that takes an array as an argument and shuffles it in place using the Fisher-Yates algorithm. The algorithm works by iterating through the array from the end to the beginning and swapping each element with a randomly chosen element before it.

Loading comments...