Skip to content

Instantly share code, notes, and snippets.

@awwong1
Created March 17, 2018 01:35
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 awwong1/35d8c4eb93fe2c90662cf4d8effac33d to your computer and use it in GitHub Desktop.
Save awwong1/35d8c4eb93fe2c90662cf4d8effac33d to your computer and use it in GitHub Desktop.
javascript roll dice
const rollDice = () => Math.floor(Math.random()*1414 % 6 + 1)
// > rollDice()
// 5
const rollNDice = (n) => Array(n).fill().map(rollDice)
// > rollNDice(6)
// [ 5, 3, 3, 5, 5, 2 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment