Created
November 23, 2011 22:23
-
-
Save todoubled/1390104 to your computer and use it in GitHub Desktop.
Randomize the order of strings in an 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
array = [ | |
"dog" | |
"cat" | |
"fish" | |
] | |
randomize = -> return (Math.round(Math.random())-0.5) | |
random = array.sort randomize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment