Article View: comp.os.msdos.programmer
Article #5002Re: Random Numbers
From: David H. Friedman
Date: Mon, 04 Mar 1991 15:25
Date: Mon, 04 Mar 1991 15:25
17 lines
1345 bytes
1345 bytes
In article <r7bGl?wz@cs.psu.edu> 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
Technical Details
Message-ID:
<1991Mar4.152534.890@linus.mitre.org>Path:
arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!think.com!linus!linus!tatum!dhfReferences:
<r7bGl?wz@cs.psu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <r7bGl?wz@cs.psu.edu> 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