How to implement the Fischer-Yates shuffle in JavaScript
What follows is an in-place reference implementation of the Fischer-Yates shuffle which is categorized as an unbiased, efficient shuffle.
This shuffle will randomly assort the contents of an array by mutating the array directly.
The algorithm’s time complexity is O(n).
|
|