Re: How to make a random number
On Wed, Apr 26, 2000 at 05:54:49PM -0600, John Galt wrote:
>
>int main ()
>{
> srand (time (0));
>/* rest of program would be here */
>}
variants such as:
pid_t pid = getpid;
srand(time(0) ^ (pid + pid << 15));
are also possible and principally used to avoid repetitive output when
the program may be invoked repeatedly over a short space of time.
Note that such contortions are obviously still deterministic.
Regards,
--
Brendan O'Dea bod@compusol.com.au
Compusol Pty. Limited (NSW, Australia) +61 2 9809 0133
Reply to: