Skip to content

Instantly share code, notes, and snippets.

@JanGalek
Created December 17, 2020 21:38
Show Gist options
  • Save JanGalek/4653919989b7027b1d280a1c55347607 to your computer and use it in GitHub Desktop.
Save JanGalek/4653919989b7027b1d280a1c55347607 to your computer and use it in GitHub Desktop.
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