[comp.sys.mac.programmer] Strange srand

rg2c+@andrew.cmu.edu (Robert Nelson Gasch) (01/31/91)

When I use the values GetDateTime() or Delay() return to initialize
srand(), I constantly get the same random number combinations every
time I call srand(), even though the value I pass into srand() changes.
This piece of code is what I do:

unsigned long int seed;
GetDateTime (&seed);   or    Delay (0, &seed);
srand (seed);

If I call this, lets say, 5 times within a minute or so, I get the
same series of random numbers every time. The series I get with
GetDateTime () never changes, while the series I get when using
Delay () to provide the seed changes only if I reboot.
Any suggestions on what causes this strange behavior?

Thanx again --> Rob