Post Reply 
HP41C random number generator help
12-05-2017, 03:24 PM (This post was last modified: 12-05-2017 03:38 PM by Trond.)
Post: #12
RE: HP41C random number generator help
(12-05-2017 08:23 AM)Dieter Wrote:  ?!? What "other programs"?

http://www.hpmuseum.org/software/41/41ranjm.htm



(12-05-2017 12:30 PM)Namir Wrote:  A good and simple algorithm (used by HP since the HP-65 Stat Pacs) is:

r = frac(997 * r)

Code:
LBL "RAND"
RCL 00
997
*
FRC
STO 00
RTN

In my HHC2017 presentation about PRNGs, I pointed out that the above legacy algorithm is recommended for its speed, simplicity, and relatively good results for calculators.

Namir

Wow, that is very simple. But it seems to assume that you start up with a number (seed) that is already non-0 and has a fraction part. Some of the other programs seem to assume similar things. Sorry if I am missing some assumptions that everyone is making here.

EDIT: ah never mind. I see Dieter already covered the same.

I see that Dieter already suggested that we can start off with pi. This is a technique I remember someone mentioning years ago, another time, another place. Maybe I could start Namir's program with adding pi?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP41C random number generator help - Trond - 12-05-2017, 05:45 AM
RE: HP41C random number generator help - Trond - 12-05-2017 03:24 PM



User(s) browsing this thread: 1 Guest(s)