Skip to content

Instantly share code, notes, and snippets.

@BlueHatbRit
Created June 28, 2020 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BlueHatbRit/9ae82a74bb8845ab6c358db62b06694c to your computer and use it in GitHub Desktop.
Save BlueHatbRit/9ae82a74bb8845ab6c358db62b06694c to your computer and use it in GitHub Desktop.
bingo-generator
const max = 50;
function shuffle(a) {
for (let i = a.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[a[i], a[j]] = [a[j], a[i]];
}
return a;
}
const unshuffled = [...Array(max).keys()].map(i => i + 1);
const shuffled = shuffle(unshuffled);
console.log(shuffled);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment