Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 51228e0 commit 88b5454Copy full SHA for 88b5454
src/shuffle/fisheryates.js
@@ -21,8 +21,8 @@
21
var size = array.length;
22
var rand;
23
var temp;
24
- for (var i = 1; i < size; i += 1) {
25
- rand = Math.round(Math.random() * i);
+ for (var i = 0; i < size; i += 1) {
+ rand = Math.floor(i + Math.random() * (size - i));
26
temp = array[rand];
27
array[rand] = array[i];
28
array[i] = temp;
0 commit comments