home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / mac / programm / 18202 < prev    next >
Encoding:
Text File  |  1992-11-09  |  1.6 KB  |  42 lines

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