Skip to content

Instantly share code, notes, and snippets.

@galElmalah
Last active May 26, 2020 19:11
Show Gist options
  • Save galElmalah/66b49f69f9b1346eb709b5088bacb895 to your computer and use it in GitHub Desktop.
Save galElmalah/66b49f69f9b1346eb709b5088bacb895 to your computer and use it in GitHub Desktop.
creating and shuffling array
const shuffledArrayInRange = (bottom = 1, top = 30) => {
const arr = [];
for (let i = bottom; i < top; i++) arr.push(i);
return arr.sort((a, b) => (Math.random() > 0.5 ? 1 : -1));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment