Post Reply 
What are good PRNG for calculators?
11-05-2014, 11:02 AM
Post: #26
RE: What are good PRNG for calculators?
(08-21-2014 07:05 PM)Thomas Klemm Wrote:  
(08-21-2014 03:25 PM)Namir Wrote:  So saying that the Rand# in the HP-15C is very good does not count, because it is already hardwired in the firmware.

This Python program simulates the RAN# function of the HP-15C:
Code:
seed = 7365289446 # or any other number

def rand():
    global seed
    seed = (1574352261 * seed + 1017980433) % 10000000000
    return seed

Of course in the HP-15C the value will be e.g. 0.7365289446 instead.

Cheers
Thomas

PS: It's similar in the HP-48. How RAND Works

Hi Thomas,

I'm so glad to find these 2 figures for the first time on the web ! 1017980433 and 1574352261.
I have a HP11C (now, I use an emulator on my iPhone) and I searched in the late 80's how the RAN function was generated. I finished to find an algorithm (not this you are using, but doing partial additions) and revealing these 2 figures.
I have programmed it in Turbo Pascal and used this as a Benchmark programm for the PCs (I was interested by numeric simulations).
Today, when I need a rand function, I always use this agorithm :-)

And you, where and how did you find it ?

Regards.

Joseph.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: What are good PRNG for calculators? - jdimijian - 11-05-2014 11:02 AM



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