Mail Archives: djgpp/1999/04/06/15:28:24
The help file speaks about 2 functions : rand() and random(). I've noticed
that rand (or random, i don't remember ;) return always the same sequence
even with a previous srandom(biostime(0,0)), but the other one works fine.
And it's a very good random generator : according to Bjarne Stroustrup
(C++'s creator), low-order bits of a random generator are often suspect, so
rand()%n is not a good way of generating a random number between 0 and n-1
(he tips to use "(double(rand())/RAND_MAX)*n" ). BUT i've tested rand()%n,
and it gives a very good repartition... So, DJGPP is the best C
implementation!!! ;)
Crousto
crousto AT infonie DOT be
- Raw text -