shuffleInPlace
shuffleInPlace(
x,randomSource?):any[]
Defined in: src/shuffle_in_place.js:18
A Fisher-Yates shuffle in-place - which means that it will change the order of the original array by reference.
This is an algorithm that generates a random permutation of a set.
Parameters
Section titled “Parameters”any[]
sample of one or more numbers
randomSource?
Section titled “randomSource?”Function
an optional entropy source that returns numbers between 0 inclusive and 1 exclusive: the range [0, 1)
Returns
Section titled “Returns”any[]
x
Example
Section titled “Example”var x = [1, 2, 3, 4];shuffleInPlace(x);// x is shuffled to a value like [2, 1, 4, 3]