Skip to content

Instantly share code, notes, and snippets.

@nandomoreirame
Last active February 17, 2019 01:43
Show Gist options
  • Select an option

  • Save nandomoreirame/24b609acabf26acd358acf42fd6718df to your computer and use it in GitHub Desktop.

Select an option

Save nandomoreirame/24b609acabf26acd358acf42fd6718df to your computer and use it in GitHub Desktop.
shuffle-array.js
const shuffleArray = (arr) =>
arr.map(a => [Math.random(), a]).sort((a, b) => a[0] - b[0]).map(a => a[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment