Created
May 12, 2016 03:29
-
-
Save Dafrok/45ceb9f6c72517589812de4debbe71e6 to your computer and use it in GitHub Desktop.
shuffle
This file contains hidden or 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
| function shuffle(ary) { | |
| let times = ary.length | |
| while (times) { | |
| ary.push(ary.splice(0 | Math.random() * times, 1)[0]) | |
| times-- | |
| } | |
| return ary | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.