Created
June 15, 2020 15:27
-
-
Save koozdra/8b7d4e2aa2da296423547fb1de9d58f9 to your computer and use it in GitHub Desktop.
javascript shuffle
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
shuffle_array = arr => | |
arr | |
.map(a => [a, Math.random()]) | |
.sort(([, lr], [, rr]) => lr - rr) | |
.map(([a]) => a); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment