12-21-2014, 10:34 PM

One of the simple Pseudo Random Number Generators (PRNG) that I saw in HP-65 software manuals is:

r1 = frac(r0 * 997)

where r0 is the current random number, and r1 is the new one. It is simple and quite good. Recently I saw a similar variant:

r1 = frac(r0 * 147)

That got me curious. Since I was already doing a study on PRNGs (running several machines 24/7 to crunch random numbers using different variants of an algorithm), I decided to take a small detour and study a selection of numbers between 100 and 1000 (all ending in 7) that can do a better job than the version using the multiplier 997.

I am happy to report that the following two PRNGs do well:

r1 = frac(r0 * 127)

and

r1 = frac(r0 * 577)

While the version with the 127 multiplier is better than the one with the 557 multiplier, it sometimes hiccups and generates sequences that are slightly more auto-correlated.

Namir

r1 = frac(r0 * 997)

where r0 is the current random number, and r1 is the new one. It is simple and quite good. Recently I saw a similar variant:

r1 = frac(r0 * 147)

That got me curious. Since I was already doing a study on PRNGs (running several machines 24/7 to crunch random numbers using different variants of an algorithm), I decided to take a small detour and study a selection of numbers between 100 and 1000 (all ending in 7) that can do a better job than the version using the multiplier 997.

I am happy to report that the following two PRNGs do well:

r1 = frac(r0 * 127)

and

r1 = frac(r0 * 577)

While the version with the 127 multiplier is better than the one with the 557 multiplier, it sometimes hiccups and generates sequences that are slightly more auto-correlated.

Namir