Created
January 8, 2013 10:25
-
-
Save Ultrabenosaurus/4482730 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
// taken from http://stackoverflow.com/a/3079423/1734964 | |
// saved for my own forgetfulness | |
function str_shuffle(string) { | |
var parts = string.split(''); | |
for (var i = parts.length; i > 0;) { | |
var random = parseInt(Math.random() * i); | |
var temp = parts[--i]; | |
parts[i] = parts[random]; | |
parts[random] = temp; | |
} | |
return parts.join(''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment