"after generating a random number, randomNumber now holds a value between 0 and 32,747. But I need a number between 1 and 6, so next I use the modulus operator to produce a number in that range
int die = (randonNumber % 6) + 1; // I know how this works.
any positive number divided by 6 will give a remainder between 0 and 5"
That last line is where i get confused... for instance lets say the value in randomNumber is 22,465 that divided by 6 is going to be between 0 and 5. my result is remainder one so that works but what happens if the value of randomNumber is 32,747 the remainder would be 8. My math could be off. So my question is, can the value never be the max? mostly every other number would produce the right remainder but not the max number. I think I understand but I just need some more info to help explain this. another thing im not quite clear on is 6 goes into 10 once with the remainder 4 so how does the value 5 come into play? if anyone can clear this up for me I'd be very grateful...