New PRNG algorithms for calculators

02152023, 10:43 PM
Post: #1




New PRNG algorithms for calculators
In 2002 I took up a project, I called Project 997, to study random number generators for calculators. I started with algorithms that used floating points (limiting the random numbers to 10 digits using MATLAB for the calculations). I based my HHC 2022 presentation for PRNGs based on that work. When I returned home, I added more floatingpointbased PRNGs and studied variants of other wellknown integerbased PRNGs like WichmannHill, ACORN, and MRG32a. The project required running several laptops daily and for many hours/day and for many weeks.
The approach I used the penalty factor that I had presented at HHC2017 and is a singly number that indicates the goodness of a batch of random numbers. The method I used included three stages: 1) Finding the least penalty factor for a relatively wide range of coefficients. This step determines the values of the optimum coefficients. 2) Finding the least penalty factor for a relatively narrow range of coefficients, based on the best coefficients obtained in step 1. 3)Generate batches of one million random numbers using random seeds and the coefficients obtained in stage 2. I wrote a sevenpart study (plus a summary of best results) and posted on my website. You can click here to access the page that lists all the parts of Project 997. Enjoy! Namir 

02162023, 02:22 PM
Post: #2




RE: New PRNG algorithms for calculators
I like how simple the 997 algorithms are, they are a godsent for calculators that do not have the (psuedo)random function.


02162023, 09:03 PM
Post: #3




RE: New PRNG algorithms for calculators
(02162023 02:22 PM)Eddie W. Shore Wrote: I like how simple the 997 algorithms are, they are a godsent for calculators that do not have the (pseudo)random function. In the last stages of my study I looked at doublerandom numbers and found two algorithms that out machoed the rest of the new algorithms in the entire study! Namir 

02172023, 08:21 PM
(This post was last modified: 02182023 12:47 AM by robve.)
Post: #4




RE: New PRNG algorithms for calculators
(02162023 09:03 PM)Namir Wrote:(02162023 02:22 PM)Eddie W. Shore Wrote: I like how simple the 997 algorithms are, they are a godsent for calculators that do not have the (pseudo)random function. Thanks for sharing your indepth study. Very interesting from a historical perspective! Note that simple "997" and "983" PRNG algorithms are used in "119 Practical Programs for the TRS80 Pocket Computer" p.64 Games  Dice Thrower: 20 "R" R=Π+983R : R=RINT R : RETURN and in p.115 Games  "Huh?": 20 L=10L*(L<[E]10)+L*(L>[E]9) : R=Π+983R : R=RINT R : T=Π+997T : T=TINT T This is to roll two dice. One dice updates with R=frac(Π+983R) and the other with T=frac(Π+997T). I didn't see the "983" algorithm results in the links, so perhaps something to add in the future.  Rob "I count on old friends"  HP 71B,PrimeTi VOY200,Nspire CXII CASCasio fxCG50...Sharp PCG850,E500,2500,1500,14xx,13xx,12xx... 

02182023, 01:29 AM
Post: #5




RE: New PRNG algorithms for calculators
(02172023 08:21 PM)robve Wrote: Thanks for sharing your indepth study. Very interesting from a historical perspective! In addition, perhaps it should be mentioned whether these PRNG pass the spectral test? And other tests such as the Chisquared test, as mentioned in an earlier post on how bad some PRNG are (e.g. Sharp PC1350) when plotting random (x,y) points. A colleague of mine is an expert on this subject and has written and published about the challenges. Even more challenging is to design Parallel PRNG and quasiRNG, an important subject in highperformance parallel Monte Carlo simulations.  Rob "I count on old friends"  HP 71B,PrimeTi VOY200,Nspire CXII CASCasio fxCG50...Sharp PCG850,E500,2500,1500,14xx,13xx,12xx... 

02182023, 02:25 PM
Post: #6




RE: New PRNG algorithms for calculators
(02182023 01:29 AM)robve Wrote:(02172023 08:21 PM)robve Wrote: Thanks for sharing your indepth study. Very interesting from a historical perspective! Part 1 lists the Matlab code that calculates the penalty function. This function performs several statistical tests and obtains results (see HHC2017 video). for each test, it compares the absolute difference of theoretic value minus the calculated result. It then multiplies that result by a weight factor. The penalty factor returns the sum of the weighted absolute differences between the theoretical values and the calculated statistics. The small the value, the better is the quality of the random number s generated. Namir 

02182023, 02:28 PM
Post: #7




RE: New PRNG algorithms for calculators
(02172023 08:21 PM)robve Wrote:(02162023 09:03 PM)Namir Wrote: I chose the integers like 991, 997, etc in an arbitrary "educated guess" fashion. some did very well (especially in the doublerandom generators (see Part 1) while others did not do well. I did not check nonHP books since I was aiming at PRNGs for the HP calculators like the HP765, HP41C, HP2s. Namir 

« Next Oldest  Next Newest »

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