Skip to content

Instantly share code, notes, and snippets.

@wlkns
Created December 16, 2020 13:18
Show Gist options
  • Select an option

  • Save wlkns/16cd9143c66518f0113badf77fe98ff9 to your computer and use it in GitHub Desktop.

Select an option

Save wlkns/16cd9143c66518f0113badf77fe98ff9 to your computer and use it in GitHub Desktop.
Lottery number picker! No duplicates, 6 numbers of 1-59.
let numbers = [...new Array(59)].map((v,i) => i+1);
let picks = [...new Array(6)].map(() => numbers.splice(Math.floor(Math.random() * numbers.length), 1)).sort((a,b) => a-b).join(", ")
console.log(picks);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment