Article View: comp.sys.mac
Article #12915Re: Random number Generator wanted.
From: David Dantowitz
Date: Fri, 29 Jun 1990 19:26
Date: Fri, 29 Jun 1990 19:26
15 lines
1108 bytes
1108 bytes
Be quite careful how you splice together random numbers to form larger random numbers. Linear-conguential random number generators (of the form: seed = seed*a mod m + b) have more "random" high order bits than low order bits. Appending two 16 bit numbers may skew your application in a way that's difficult to measure. If you want a 32 bit random number then check out Knuth for some multipliers (a) and modulos (m) that will give you "good" random numbers. Sorry I don't have it handy. -- David Dantowitz Singing Barbershop when not computing
Technical Details
Message-ID:
<18200@ttidca.TTI.COM>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!samsung!uunet!psivax!quad1!ttidca!daviddReferences:
<152@asacsg.mh.nl> <1990Jun29.020739.9146@Neon.Stanford.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!samsung!uunet!psivax!quad1!ttidca!davidd From: davidd@ttidca.TTI.COM (David Dantowitz) Newsgroups: comp.sys.mac,comp.sys.mac.programmer,comp.sys.mac.misc,comp.sys.mac.system Subject: Re: Random number Generator wanted. Keywords: Random number Message-ID: <18200@ttidca.TTI.COM> Date: 29 Jun 90 19:26:24 GMT References: <152@asacsg.mh.nl> <1990Jun29.020739.9146@Neon.Stanford.EDU> Organization: Citicorp/TTI, Santa Monica Lines: 15