Mail Archives: djgpp/1999/07/16/11:34:48
>From: "Börje Granberg" <borje DOT granberg AT ebox DOT tninet DOT se>
>Subject: ---Random question---
>Date: Fri, 16 Jul 1999 15:55:44 +0200
>
>I know there are commands like rand() and random() but how do I get a
>random
>number between 1 and 100?
DJGPP's version of random() produces a number between 0 and RAND_MAX.
To limit the range of random() to produce numbers 1-100, just use
(random()%100) + 1;
Kirill Orlov
_______________________________________________________________
Get Free Email and Do More On The Web. Visit http://www.msn.com
- Raw text -