View Single Post
Re: srand() aberration ???
Old
  (#10)
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 ??? - 20-06-2004

Because you HAVE to call srand() at least once if you intend to use rand()... else each time you run the program you'll have the same series of numbers.

rand() is based on a math suite. Not sure its the real word. It's just like the math quizs for children : given the number you have, and the number before, and the number before it, deduce the number that's going to come right after. rand() is just that. If you don't initialize the seed (that is, the initial number of the suite) the output values will always be the same.

hrm, I should go to bed. sorry. 8am here.



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