The rand() funtion returns a random number between 0 and RAND_MAX, which defines an integer value that is 32,767 or larger.
that means, rand() by itself can't reach 100,000.
i had this idea a few months ago, why not add together multiple calls of rand() function.
to generate a number between 0 and 1m, and if RAND_MAX is 32,767.
you'll need to add about 31 calls of rand() together, you gotta watch though, you shouldn't MULTIPLY one call of rand() by 31, because this will affect randomness.
you could try this:
1 2 3
|
int rnd = 0;
for(int i = 0; i<31 ; i++)
rnd += rand();
|
then use the value of rnd.
hope that helped.