From: br5an AT aol DOT com (Br5an) Newsgroups: comp.os.msdos.djgpp Subject: Re: Automatically seeding random numbers Date: 4 Feb 1998 22:40:15 GMT Lines: 11 Message-ID: <19980204224001.RAA25173@ladder02.news.aol.com> NNTP-Posting-Host: ladder02.news.aol.com Organization: AOL http://www.aol.com References: <34D80662 DOT CD7C1FC AT ea DOT oac DOT uci DOT edu> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Jason wrote: << Basically, I'd like a program to (automatically) seed srand() with a different value each time the program is run. (Currently I require the user to type in a seed, which is a nuisance.) Initially, I thought something as simple as srand(clock()) would work, but then I found out that clock() only returns the number of clock ticks since the *last* call of clock(), so clock() always returns the value 0 when called for the first time.>> I think srand(time(NULL)); might be what your looking for.