Skip to content

Instantly share code, notes, and snippets.

@faridlab
Last active January 5, 2018 12:55
Show Gist options
  • Save faridlab/27bcd04bef4a51796f6b666d9c6ad370 to your computer and use it in GitHub Desktop.
Save faridlab/27bcd04bef4a51796f6b666d9c6ad370 to your computer and use it in GitHub Desktop.
Javascript Shuffle Array
const shuffle = array.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