home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!news.Hamburg.Germany.EU.net!mwhh!dmhh!detlef
- From: detlef@dmhh.hanse.de (Detlef Mueller)
- Newsgroups: comp.sys.hp48
- Subject: Re: HP's RAND algorithm
- Distribution: world
- Message-ID: <715705766snx@dmhh.hanse.de>
- References: <1992Sep4.183731.130@news.uiowa.edu>
- Date: Sat, 05 Sep 92 15:09:26 GMT
- Organization: Who is Organized ?
- Lines: 34
-
- jollie@zambini.cs.uiowa.edu writes in article <1992Sep4.183731.130@news.uiowa.edu>:
- >
- > 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.
- >
- > Jeff Ollie
- > jollie@zambini.cs.uiowa.edu "The Happy User"
- >
-
- Don't worry, RAND is basing on a linear congruential method (see pg. 9 of
- 'The Art of ...', Vol.2 by D.E. Knuth):
-
- Xn+1 = (a * Xn + c) mod m
-
- where
- a = 2851130928467
- c = 0
- m = 1E15
-
- The intial value of X0 after a memory lost is 999500333083533.
-
- If you choose an X0 which isn't a multiple of 2 or 5 then you'll get a
- period of 5E13 (see pg. 20 of above book - a mod 200 is 67).
-
- Bye,
- 8-Detlef
- --
- +------------------------------------+--------------------------------------+
- |`What a depressingly stupid machine'| Detlef Mueller |
- | -- Marvin | detlef@dmhh.hanse.de |
- +------------------------------------+--------------------------------------+
-