Created
October 31, 2019 12:55
-
-
Save atoko/ee7f39cb90ab2fc81fab3e9c5ca787d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let shuffle = function(array) { | |
for (var c = array.length - 1; c > 1; c--) { | |
var r = (Math.random() * c).toFixed(0); | |
var one = array[r]; | |
var two = array[c]; | |
if (one !== null) { | |
array[c] = one; | |
array[r] = two; | |
} | |
} | |
return array; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment