From: Damian Yerrick Newsgroups: comp.os.msdos.programmer,comp.os.msdos.djgpp Subject: Re: Uptime and entropy in DOS Organization: Pin Eight Software http://pineight.8m.com/ Message-ID: References: <38A5583C DOT EDF375B4 AT is DOT elta DOT co DOT il> <591baskf2ns6u0n0l6kp8rgml7aa2q80la AT 4ax DOT com> <38a5a2da_1 AT news DOT uni-bielefeld DOT de> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 39 X-Trace: /b/VKW4eqAo+gdImx4n92+9Z7+T/qEUPFDaNUUb6dNDZNNMb52gBgIWHh+H5UNopaHjDFnAcuGaH!DdfB5m7sb4Q7Lm0vfwLG+EIrrmayFEpKbLMyorvBvx4wp55QxD5sQhe8efF3H3WqMN4q4mtBLN9m!550IJEg= X-Complaints-To: abuse AT gte DOT net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly NNTP-Posting-Date: Sun, 13 Feb 2000 00:00:22 GMT Distribution: world Date: Sun, 13 Feb 2000 00:00:22 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Sat, 12 Feb 2000 18:13:37 GMT, manni DOT heumann AT gmx DOT de (Manni Heumann) wrote: >Damian Yerrick wrote: >>Eli Zaretskii wrote: >>>Damian Yerrick wrote: >>>> >>>> Is it possible to get the uptime of a DOS system? I need more entropy >>>> than the 32 bits I get from time(NULL) to initialize a pseudorandom >>>> number generator. >>> >>>Did you try `uclock' or `gettiomeofday'?. >> >>uclock() measures uptime of the current process, which is known >>to be zero when I seed my PRNG. gettimeofday() can be calculated >>from time(NULL), which I'm already using. > >I'm nosy: Why isn't all of this enough for you? Oh, now that I've rtfm again, it seems that srandom(time(NULL)); will work fine. I've selected BSD random() (the new one with the better seeder) with the obsolete advertising clauses removed (Berkeley dropped them as of June 1999). Is it possible to link BSD copyright files into a GPL program? BSD random() seems to use the Apple RNG x = (x * 16807) % ((2 << 31) - 1); to play with the seed. >What about the user? How about a "Any key to continue" message >and you measure the time it takes to answer that one And watch people press the any key, anticipating the message, while the game is showing the copyright/loading screen. -- Damian Yerrick http://yerricde.tripod.com/ Comment on story ideas: http://home1.gte.net/frodo/quickjot.html AOL is sucks! Find out why: http://anti-aol.org/faqs/aas/ View full sig: http://www.rose-hulman.edu/~yerricde/sig.html