Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var terminalInput = {
- stringArray: process.argv.slice(2),
- numberArray: function(stringArray){
- var x = []
- for(var i = 0; i < stringArray.length; i++) {
- x.push(stringArray[i])
- } return x
- },
- string: process.argv[2],
- number: Number(process.argv[2]),
- }
- function getRandomIntInclusive(max) {
- return Math.floor((Math.random() * max) + 1);
- // min = Math.ceil(min);
- // max = Math.floor(max);
- // result = Math.floor(Math.random() * (max - min + 1)) + min; //The maximum is inclusive and the minimum is inclusive
- // return result
- }
- function diceRoll(){
- var roll = getRandomIntInclusive(6)
- return roll
- }
- function rollManyDice(input) {
- result = []
- for(var i = 0; i < input; i++) {
- result.push(diceRoll())
- }
- console.log(result)
- }
- rollManyDice(terminalInput.number)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement