Good morning,
I have a program, running on UNIX Solaris 5.8, on which there is development kit "dbx 6.2".
This program uses the C++ function "rand()".
My customer now complaints that regularly the result of this function seems to be the same.
Therefore he asks what is the frequency of the random seed change.
Does anybody know this (the function "srand()" is not used at this time)?
rand() is a linear congruential random number generator.
Let the value Xn be the Nth random number generated by the generator. Then X0 is the initial seed, and
Xn = ( X(n-1) * C1 + C2 ) mod C3, where C1, C2, and C3 are pre-defined constants and C3 is typically
2^32 on a 32-bit machine and 2^64 on a 64-bit machine.
As Denis said, you must call srand() exactly once in your program to set X0.