Mail Archives: djgpp/1998/02/25/13:18:47
What I always do is this
#define Random(x) (random() % x)
and then just use Random. This works quite well. The only thing with this is
that you can't get random numbers bigger that MAXINT. I think rand() does
this but you should find that out yourself.
If you want to have a random function that gives a floatingpoint result,
usae something like this.
#define FPRandom() (random() / (double)MAXINT)
Foxe,
home.westbrabant.net/~pginkel
(Is going to be better if I finally get the time...)
-----Oorspronkelijk bericht-----
Van: Stephan <saf AT magic DOT fr>
Nieuwsgroepen: comp.os.msdos.djgpp
Aan: djgpp AT delorie DOT com <djgpp AT delorie DOT com>
Datum: woensdag 25 februari 1998 1:13
Onderwerp: Re: How to limit a random() with DJGPP ?
>i have put a randomize example on my page under tutorials.
>go to: http://www.mygale.org/03/mine/
>--
>****************************************
>* THE DJGPP MINE !!! *
>* FREE SOURCE CODES, FAQ, INFOS, LINKS *
>****************************************
>* http://www.mygale.org/03/mine/ *
>****************************************
>* 24h/24h 7/7days *
>****************************************
- Raw text -