Originally posted by Cela
>> I always thought the point of having a standard was to make things standard.
Using the modulus or division to get a range from rand() has nothing to do with the standard, its a technique, not a language feature. :-)
Why doesn't the standard library have a function that will return a random number within certain limits? That would solve this problem, wouldn't it? Something like:
Code:
int spiffy_rand(int low, int high);
Okay, maybe that identifier could use some work, but I think you get the idea.