I'm confused about this

Doug Gwyn gwyn at smoke.brl.mil
Wed Nov 21 04:35:07 AEST 1990


In article <3945 at vela.acs.oakland.edu> jmwojtal at vela.acs.oakland.edu (Wojo) writes:
-I got this C program and this part I don't understand:
-int   getpid();
-long  now;
-now = time(&now) / rand();
-srand(getpid() + (int)((now >> 16) + now + time(&now)));
-What does "srand" do to be exact?  It doesn't bring a value back?
-"getpid()" is declared, but the function is not in the program.

srand() initializes the seed for the pseudo-random number generator rand().
getpid() returns the process ID of the current process.
These are in the UNIX programmer's reference manual, q.v.



More information about the Comp.lang.c mailing list