Created
August 27, 2014 19:17
-
-
Save cuprum/f786976d67d46ccb4215 to your computer and use it in GitHub Desktop.
Shuffle Array
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
//+ Jonas Raoni Soares Silva | |
//@ http://jsfromhell.com/array/shuffle [rev. #1] | |
shuffle = function(v){ | |
for(var j, x, i = v.length; i; j = parseInt(Math.random() * i), x = v[--i], v[i] = v[j], v[j] = x); | |
return v; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment