Mail Archives: djgpp/1999/07/29/10:24:28
Use rand()%256 for number between 0 and 255.
----------
> From: Börje Granberg <borje DOT granberg AT ebox DOT tninet DOT se>
> To: djgpp AT delorie DOT com
> Subject: -- Random question --
> Date: Saturday, July 24, 1999 10:29 AM
>
> I know there are commands like rand() and random() but how do I get a
random
> number between 1 and 100?
>
> In BASIC it is easy because there you get a random (float) number between
0
> and 1 that you can multiplicate with 100 and add 1, but I dont see that
> opportunity in C++ or have my eyes missed that part?
>
>
> --
> /Börje
>
>
>
- Raw text -