Skip to content

Instantly share code, notes, and snippets.

@snowman-repos
Created February 6, 2014 08:46
Show Gist options
  • Save snowman-repos/8840523 to your computer and use it in GitHub Desktop.
Save snowman-repos/8840523 to your computer and use it in GitHub Desktop.
Shuffle an array of numbers
numbers = [
5
458
120
-215
228
400
122205
-85411
]
numbers = numbers.sort ->
Math.random() - 0.5
# the array numbers will be equal for example to [120, 5, 228, -215, 400, 458, -85411, 122205]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment