Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!sdd.hp.com!caen!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: I'm confused about this Keywords: getpid(), srand Message-ID: <14536@smoke.brl.mil> Date: 20 Nov 90 17:35:07 GMT References: <3945@vela.acs.oakland.edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 12 In article <3945@vela.acs.oakland.edu> jmwojtal@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.