home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!rpi!uwm.edu!ogicse!news.u.washington.edu!nntp.uoregon.edu!nntp.uoregon.edu!stevev
- From: stevev@miser.uoregon.edu (Steve VanDevender)
- Newsgroups: comp.sys.hp48
- Subject: Re: HP's RAND algorithm
- Message-ID: <STEVEV.92Sep5145750@miser.uoregon.edu>
- Date: 5 Sep 92 21:57:50 GMT
- Article-I.D.: miser.STEVEV.92Sep5145750
- References: <1992Sep4.183731.130@news.uiowa.edu>
- Sender: news@nntp.uoregon.edu
- Organization: University of Oregon Chemistry Stores
- Lines: 28
- In-Reply-To: jollie@zambini.cs.uiowa.edu's message of Fri, 4 Sep 1992 18:37:31 GMT
-
-
- In article <1992Sep4.183731.130@news.uiowa.edu> jollie@zambini.cs.uiowa.edu (Jeffrey C. Ollie) writes:
-
- I just got my 48SX, and I love it! But, I was wondering what algorithm
- HP used for the random number generator. I'm hoping that it is a
- prime modulus multiplicative linear conguential generator (I'm not
- making this up) with a=16807 and m=2^31 - 1. I've written one of my own,
- but would prefer to use the built in RAND.
-
- The HP 48 uses a multiplicative linear congruential generator (I
- know you're not making it up) but not the particular one you
- speak of. It uses the formula
-
- R(n+1) = R(n) * 2851130928467 (mod 10^15)
-
- to generate a 15 decimal digit internal seed. The random number
- returned is R(n+1) / 10^15 rounded to 12 decimal digits.
-
- The random number seed R(n) is stored in BCD at #706A4. If the
- seed is 0, then the seed is reset to 999500333083533.
-
- This information was obtained by disassembling the system RPL
- routine %RAN, a primitive code object at #2AFC2.
- --
- Steve VanDevender stevev@greylady.uoregon.edu
- "Bipedalism--an unrecognized disease affecting over 99% of the population.
- Symptoms include lack of traffic sense, slow rate of travel, and the
- classic, easily recognized behavior known as walking."
-