Zebra0.com

cpp randomRolling dice

Rolling dice

To roll dice we need to generate a random number, then find the remainder when we divide by 6. This will give us a value from 0 to 5. We add 1 to that to get a value from 1 to 6.