Skip to content

Instantly share code, notes, and snippets.

@amerllica
Created June 23, 2019 13:36
Show Gist options
  • Save amerllica/de594d5489c52f225c12ab5032b4b0e1 to your computer and use it in GitHub Desktop.
Save amerllica/de594d5489c52f225c12ab5032b4b0e1 to your computer and use it in GitHub Desktop.
Simple array shuffler (Using reduce function)
const shuffler = array => array.reduce((accumulator, currentValue) => {
const randomIndex = Math.ceil(Math.random() * 10);
accumulator.splice(randomIndex, 0 ,currentValue);
return accumulator;
}, []);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment