Skip to content

Instantly share code, notes, and snippets.

@okovalov
Created June 11, 2020 16:05
Show Gist options
  • Save okovalov/aed6057958bda3e853e8ea92ebd8338d to your computer and use it in GitHub Desktop.
Save okovalov/aed6057958bda3e853e8ea92ebd8338d to your computer and use it in GitHub Desktop.
const shuffle = arr => arr.sort(() => Math.random() - 0.5)
const data = [1, 2, 3, 4, 5, 6, 7, 8, 9]
console.log('Data 1', data)
console.log('Data 2', shuffle(data))
console.log('Data 3', shuffle(data))
console.log('Data 4', shuffle(data))
console.log('Data 5', shuffle(data))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment