Skip to content

Instantly share code, notes, and snippets.

@RcrdBrt
Created November 13, 2016 17:28
Show Gist options
  • Save RcrdBrt/a0b3e8680eb31f1763e17cbb88ae13a8 to your computer and use it in GitHub Desktop.
Save RcrdBrt/a0b3e8680eb31f1763e17cbb88ae13a8 to your computer and use it in GitHub Desktop.
const colors = require('colors/safe');
// 6-sided dice
var min = 1,
max = 6,
first = roll(min, max),
second = roll(min, max);
console.log("Dice 1:", first);
console.log("Dice 2:", second);
console.log(colors.cyan(colors.bold("Tot: " + (first + second))));
function roll(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment