Quote below is directly from Deitel's book:
Quote:
|
For GNU C++, the value of RAND_MAX is 214748647; for Visual Studio, the value of RAND_MAX is 32767
|
Thanx a lot rpgfan3233 for the detail explanation, the equation helps a lot
Edit:
Quote:
|
min_value + rand() % (max_value - min_value + 1)
|
This equation right here, why there is "- min_value + 1" ??? I think it's kind of weird, so for example if I use min value of 2 then my maximum would be 6-1 = 5 !!!??? XD that will require me to do:
to keep the same maximum of "6" ??? I think that's kind of weird..
