HP41C random number generator help
12-08-2017, 04:26 AM (This post was last modified: 12-08-2017 04:33 AM by Trond.)
Post: #21
 Trond Member Posts: 139 Joined: Sep 2017
RE: HP41C random number generator help
(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
I tried a version of this while trying to avoid "bad seeds". I built a program that first checks if the variable 00 has anything above 0 beyond the fifth decimal point, and if not it adds pi, then goes on to multiply with 997, does FRC and STO 00. If 00 does have a digit at the fifth decimal it will simply do the last three steps. Looks to work fine for me, but it is no longer as simple of course.
 « Next Oldest | Next Newest »

 Messages In This Thread HP41C random number generator help - Trond - 12-05-2017, 05:45 AM RE: HP41C random number generator help - Paul Dale - 12-05-2017, 05:52 AM RE: HP41C random number generator help - Trond - 12-05-2017, 06:02 AM RE: HP41C random number generator help - Paul Dale - 12-05-2017, 06:06 AM RE: HP41C random number generator help - Dieter - 12-05-2017, 08:31 AM RE: HP41C random number generator help - Sylvain Cote - 12-05-2017, 06:08 AM RE: HP41C random number generator help - Trond - 12-05-2017, 06:33 AM RE: HP41C random number generator help - Trond - 12-05-2017, 10:25 PM RE: HP41C random number generator help - Trond - 12-05-2017, 06:12 AM RE: HP41C random number generator help - Dieter - 12-05-2017, 08:23 AM RE: HP41C random number generator help - Namir - 12-05-2017, 12:30 PM RE: HP41C random number generator help - Trond - 12-05-2017, 03:24 PM RE: HP41C random number generator help - Dieter - 12-05-2017, 06:54 PM RE: HP41C random number generator help - Trond - 12-05-2017, 07:50 PM RE: HP41C random number generator help - Dieter - 12-05-2017, 08:11 PM RE: HP41C random number generator help - Trond - 12-08-2017 04:26 AM RE: HP41C random number generator help - Dieter - 12-08-2017, 07:43 PM RE: HP41C random number generator help - Trond - 12-08-2017, 09:17 PM RE: HP41C random number generator help - Dieter - 12-08-2017, 09:56 PM RE: HP41C random number generator help - Mike T. - 12-21-2021, 07:09 PM RE: HP41C random number generator help - Dieter - 12-09-2017, 09:53 PM RE: HP41C random number generator help - Trond - 12-10-2017, 04:09 AM RE: HP41C random number generator help - ttw - 12-05-2017, 01:43 PM RE: HP41C random number generator help - Trond - 12-05-2017, 03:53 PM RE: HP41C random number generator help - Thomas Okken - 12-05-2017, 05:21 PM RE: HP41C random number generator help - Trond - 12-05-2017, 06:32 PM RE: HP41C random number generator help - Garth Wilson - 12-05-2017, 07:33 PM RE: HP41C random number generator help - Trond - 12-21-2021, 06:25 AM RE: HP41C random number generator help - ttw - 12-22-2021, 03:58 AM RE: HP41C random number generator help - John Keith - 12-22-2021, 07:02 PM

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