Fix bug where round could end up out of range (could happen 1/(n*2) times)"

`Math.round` could end up out of range. For an array of length N, `Math.random()` times N could result in the number N if sufficiently close to 1, making the array out of range. The fix is to use floor instead of round.