Cuyahoga Community College Passing the Dice Rolling Method Lab

For this lab, start with your completed lab 13.

Now, instead of just passing the dice rolling method the number of dice to roll, also pass a second value. This second value should be the size of the dice.

  • In D&D, there are 4, 6, 8, 10, 12, 20, 30 etc… sided dice.
    • So, perhaps you will tell the method to roll 2, 6 sided dice.
    • Or perhaps you will tell the method to roll 1, 8 sided die.
    • Or maybe even you will tell the method to roll 13, 9 sided dice. (not sure if that is a thing…)

So, in this case, your roll dice method must accept two parameters.

Hint:

So far, when using random, we have gone from a set range such as:

rnd.next(1, 7);

How can you change that line (it will be the 7 that gets changed) to accommodate a value that isn’t known before the program is executed?