Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!think.com!linus!linus!tatum!dhf From: dhf@tatum.mitre.org (David H. Friedman) Newsgroups: comp.os.msdos.programmer Subject: Re: Random Numbers Message-ID: <1991Mar4.152534.890@linus.mitre.org> Date: 4 Mar 91 15:25:34 GMT References: Sender: dhf@linus.mitre.org (David H. Friedman) Distribution: comp Organization: The MITRE Corporation, Bedford, MA 01730 Lines: 17 Nntp-Posting-Host: tatum.mitre.org In article melling@cs.psu.edu (Michael D Mellinger) writes: > >How can I get a random number on on DOS machines? Seeding the random ># generator with the system clock seemed like a good idea, but not all >machines have clocks. > Seeding from the system clock generally is a good idea, but if there's no clock, one idea that comes to mind is to save the last random value generated as part of a run, and use it as the seed in the next run. This would involve writing, reading and rewriting a short file. As for use of rand(), usually the random values produced are not so random - for a good discussion, check the chapter on random number generation in Numerical Recipes in C (Press, Flannery, Teukolsky, and Vetterling - Cambridge Univ. Press). Hope this helps. dhf@linus.mitre.org