Created
December 17, 2020 21:38
-
-
Save JanGalek/4653919989b7027b1d280a1c55347607 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
const shuffle = (items: any) => { | |
let length = items.length | |
while (length !== 0) { | |
let randId = Math.floor(Math.random() * length) | |
length -= 1 | |
let tmp = items[length] | |
items[length] = items[randId] | |
items[randId] = tmp | |
} | |
return items | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment