home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!swrinde!elroy.jpl.nasa.gov!decwrl!decwrl!apple!mumbo.apple.com!wingosmac.apple.com!user
- From: wingo@apple.com (Tony Wingo)
- Subject: Re: looking for a REALLY RaNdOM "RANDOM"
- Sender: news@mumbo.apple.com (The News System)
- Message-ID: <wingo-091192133036@wingosmac.apple.com>
- Date: Mon, 9 Nov 1992 21:38:04 GMT
- References: <1djhjiINNhlc@mthvax.cs.miami.edu>
- Organization: Apple Computer
- Followup-To: comp.sys.mac.programmer
- Lines: 29
-
- In article <1djhjiINNhlc@mthvax.cs.miami.edu>, rsherman@mthvax.cs.miami.edu
- (Roby Sherman) wrote:
- >
- > Hello all.
- >
- > I'm looking for a pascal piece of code that illustrates a really nice
- > random number generation.
- >
- > I'm working on an INIT that needs a few random numbers and at boot time,
- > Apple's RANDOM function seems to always retrurn the same old thing.
- > Any ideas?
- >
-
- To the best of my knowlege, Apple's random number generator is based on
- Park and Miller's "Minimal Standard Random Number Generator", which is
- about as good as you are going to get for a 31-bit multiplicative residue
- RNG. The reason you are always getting the same sequence is that you are
- not setting the seed to something different each time you start up. Set it
- to something like the time of day.
-
- For coding examples, and some theory, check out Park and Miller's article:
- "Random Number Generators: Good Ones Are Hard To Find", CACM Vol 31, Number
- 10 (Oct 1988).
-
- And of course, if you really want to get down to the nitty-gritty theory
- behind RNG's, there is always Vol 2. of Knuth.
-
- -tony
- >>usual disclaimer<<
-