Mail Archives: djgpp/2000/05/27/18:29:02
Chris Miller wrote:
> If RAND_MAX is set to 100, then a call to rand() should return an
> integer between 0 and 100. However, on my computer, a call to rand()
> generates a number between what appears to be hundreds of millions and
> 0, even with RAND_MAX set to 100.
You can try sth like this:
int lotto;
lotto = rand() % 100;
of course if you want to get numbers between 0 and 100...
________________________________________
Grzegorz Patola
email: ivan AT zeus DOT polsl DOT gliwice DOT pl
Alternative email: gpatola AT lemon DOT ia DOT polsl DOT gliwice DOT pl
ICQ# 1448779
- Raw text -