Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. var terminalInput = {
  2. stringArray: process.argv.slice(2),
  3. numberArray: function(stringArray){
  4. var x = []
  5. for(var i = 0; i < stringArray.length; i++) {
  6. x.push(stringArray[i])
  7. } return x
  8. },
  9. string: process.argv[2],
  10. number: Number(process.argv[2]),
  11. }
  12.  
  13. function getRandomIntInclusive(max) {
  14. return Math.floor((Math.random() * max) + 1);
  15. // min = Math.ceil(min);
  16. // max = Math.floor(max);
  17. // result = Math.floor(Math.random() * (max - min + 1)) + min; //The maximum is inclusive and the minimum is inclusive
  18. // return result
  19. }
  20.  
  21. function diceRoll(){
  22. var roll = getRandomIntInclusive(6)
  23. return roll
  24. }
  25.  
  26. function rollManyDice(input) {
  27. result = []
  28. for(var i = 0; i < input; i++) {
  29. result.push(diceRoll())
  30. }
  31. console.log(result)
  32. }
  33.  
  34. rollManyDice(terminalInput.number)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement