View Single Post
Re: srand() aberration ???
Old
  (#4)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: srand() aberration ??? - 14-06-2004

that's what I have here too. The first numbers are ALWAYS the same.

But now, even more weird: I notice that instead of doing
Code:
srand (time (NULL)); // initialize random seed
if I do
Code:
srand (GetTickCount ()); // initialize random seed
instead, then it does work normally (i.e, the first numbers are different this time).

What the ... ???

@botman
I might be wrong, but I think doing
Code:
rand () % 100
ends up with a not so random pseudo-random number generation. Doing a modulo unevens the distribution of the numbers in the suite along the {0, 100} axis. Any math brute (Hey Joe!) to confirm ?



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 14-06-2004 at 14:30..
  
Reply With Quote