Last active
January 24, 2017 15:46
-
-
Save namomo/06955905908f1fe6328a 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
var arr = [0, 1, 2, 3, 4, 5]; | |
arr.sort(function(a, b) { return -0.5+Math.random(); }); | |
// or | |
Array.prototype.randomSort = function() { | |
this.sort(function(a, b) { | |
return -0.5+Math.random(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment