Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.0.0
-
None
Description
The Utils.randomizeInPlace method, which is meant to uniformly shuffle the elements on an input array, never shuffles elements to their starting position. That is, every permutation of the input array is equally likely to be returned, except for any permutation in which any element is in the same position where it began. These permutations are never output.
This is because line 827 of Utils.scala should be
val j = rand.nextInt(i + 1)
instead of
val j = rand.nextInt( i )