02-25-2017, 10:02 PM (This post was last modified: 02-26-2017 08:04 AM by Namir.)
Post: #1
 Namir Senior Member Posts: 615 Joined: Dec 2013
Hi,

I was browsing in the old HP-41C program library and I found this link for "Random Number Generators for the HP-41" by Jean-Marc Baillard. This link points out to five PRNGs (the first four are more serious). The first four HP-1C programs seem very usable. Has anyone used these PRNGs? Your take on these algorithms?

Namir
02-26-2017, 06:51 AM
Post: #2
 ttw Member Posts: 144 Joined: Jun 2014
Just looking quickly leads me to guess that program #2 is best. Which number to use for the multiplier depends on the continued fraction expansion of that multiplier and 9,999,999,967. One with smaller partial quotients will generally be better.

Program #1 isn't too bad; the multiplier (9821 in this case) seems designed to give the longest period modulo a power of 10. Again, one should choose a pair with a continued fraction expansion with small partial quotients.
02-26-2017, 03:17 PM
Post: #3
 John Keith Senior Member Posts: 353 Joined: Dec 2013
Note that though it references the well-known formula xn+1 = FRC ( 9821 xn + 0.211327 ), his program 1 is actually xn+1 = FRC ( 9^8 xn + 0.236067977 ).

Programs 1 and 2 both sound interesting. As Jean-Marc's post is 13 years old, I wonder if anyone has tested these RNG's using Knuth's spectral test or other methods?

John
02-26-2017, 03:23 PM (This post was last modified: 02-26-2017 03:23 PM by Ángel Martin.)
Post: #4
 Ángel Martin Senior Member Posts: 926 Joined: Dec 2013
(02-26-2017 03:17 PM)John Keith Wrote:  Programs 1 and 2 both sound interesting. As Jean-Marc's post is 13 years old, I wonder if anyone has tested these RNG's using Knuth's spectral test or other methods?

Here's the current link to his own web site, likely to be more current that the one in the forum:

http://hp41programs.yolasite.com/alea.php
02-27-2017, 12:15 PM
Post: #5
 Namir Senior Member Posts: 615 Joined: Dec 2013
(02-26-2017 03:23 PM)Ángel Martin Wrote:
(02-26-2017 03:17 PM)John Keith Wrote:  Programs 1 and 2 both sound interesting. As Jean-Marc's post is 13 years old, I wonder if anyone has tested these RNG's using Knuth's spectral test or other methods?

Here's the current link to his own web site, likely to be more current that the one in the forum:

http://hp41programs.yolasite.com/alea.php

Jean-Marc's site has mainly put the same information in a nicer and colored format. I did not see any significant change. Still good code in my book!!

Namir
03-03-2017, 01:18 AM
Post: #6
 Chris Hanson Junior Member Posts: 1 Joined: Mar 2017
There has been a lot of work in PRNGs in the last decade or so.

Many older PRNGs, particularly the simpler ones, are no longer considered adequate for many purposes, despite the fact that they pass the spectral test.

While there are many prominent researchers in this area, I have appreciated the work done by George Marsaglia. See the Wikipedia page for more information.
03-03-2017, 05:56 AM
Post: #7
 Namir Senior Member Posts: 615 Joined: Dec 2013
(03-03-2017 01:18 AM)Chris Hanson Wrote:  There has been a lot of work in PRNGs in the last decade or so.

Many older PRNGs, particularly the simpler ones, are no longer considered adequate for many purposes, despite the fact that they pass the spectral test.

While there are many prominent researchers in this area, I have appreciated the work done by George Marsaglia. See the Wikipedia page for more information.

I do make a big distinction between simpler PRNGs for calculators and PRNGs for computer aplications. The two PRNGs belong in two different classes. The PRNGs by J.M Bailliard belong to vintage calculators and, in most likelihood, will not provide high-standard randomness for computer applications. Nevertheless, calculator PRNGs provide adequate random numbers for calculator games and simulations where the total number of random number generated is relatively small, compared to computer applications.
03-03-2017, 06:04 AM (This post was last modified: 03-03-2017 06:04 AM by Ángel Martin.)
Post: #8
 Ángel Martin Senior Member Posts: 926 Joined: Dec 2013
(03-03-2017 05:56 AM)Namir Wrote:  I do make a big distinction between simpler PRNGs for calculators and PRNGs for computer aplications. The two PRNGs belong in two different classes. The PRNGs by J.M Bailliard belong to vintage calculators and, in most likelihood, will not provide high-standard randomness for computer applications. Nevertheless, calculator PRNGs provide adequate random numbers for calculator games and simulations where the total number of random number generated is relatively small, compared to computer applications.

Complete agreement.

On the CX of course the dilemma is non-existing: TIME does the randomness for you...
03-03-2017, 08:09 AM
Post: #9
 Paul Dale Senior Member Posts: 1,434 Joined: Dec 2013
The 34S has a reasonably modern Tausworthe generator. I'd have liked to have included a Mersenne twister based RAND but there wasn't enough RAM for it. Neither of these is up to cryptographic standards but they are decent enough for other purposes.

Pauli
03-03-2017, 11:01 PM (This post was last modified: 03-04-2017 04:19 AM by Namir.)
Post: #10
 Namir Senior Member Posts: 615 Joined: Dec 2013
(03-03-2017 08:09 AM)Paul Dale Wrote:  The 34S has a reasonably modern Tausworthe generator. I'd have liked to have included a Mersenne twister based RAND but there wasn't enough RAM for it. Neither of these is up to cryptographic standards but they are decent enough for other purposes.

Pauli

Pauli,

I agree that the 34S has the best PRNG. The WP-42S is in a class apart.

Namir
03-04-2017, 12:10 AM
Post: #11
 emece67 Senior Member Posts: 363 Joined: Feb 2015
The microcontroller inside the dm42/wp43 does have a true random number generator inside it. We are at the threshold of a new kind of "randomness" in our machines.

César - Information must flow.
03-04-2017, 03:06 AM
Post: #12
 brickviking Senior Member Posts: 325 Joined: Dec 2014
(03-03-2017 11:01 PM)Namir Wrote:  ...
I agree that the 34S has the best PRNG. The WP-24S is in a class apart.
...

I've never seen a WP-24S. I'm guessing this was a WP-34S instead?

(Post 55)

Regards, BrickViking
HP-50g |Casio fx-9750G+ |Casio fx-9750GII (SH4a)
03-04-2017, 09:08 AM
Post: #13
 Paul Dale Senior Member Posts: 1,434 Joined: Dec 2013
(03-04-2017 12:10 AM)emece67 Wrote:  The microcontroller inside the dm42/wp43 does have a true random number generator inside it. We are at the threshold of a new kind of "randomness" in our machines.

I'm actually be a bit sceptical of TRNGs in hardware -- I've seen more than a few that were biassed and that needed software assistance to produce good random output. Of course this fix is entirely possible in the dm42/wp34. I'd be more than able to implement a NIST SP 800-90b compliant RNG.

- Pauli
03-04-2017, 03:37 PM
Post: #14
 Namir Senior Member Posts: 615 Joined: Dec 2013
(03-04-2017 03:06 AM)brickviking Wrote:
(03-03-2017 11:01 PM)Namir Wrote:  ...
I agree that the 34S has the best PRNG. The WP-24S is in a class apart.
...

I've never seen a WP-24S. I'm guessing this was a WP-34S instead?

(Post 55)

I do have my own unique version of the WP-24S ... I just took an existing WP-34S and relabeled it WP-24S ... :-)

Namir
 « Next Oldest | Next Newest »

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