3 ms·
This is the most in-depth analysis of Marsaglia's mental PRNG I've seen. A question, though. The author writes: > So what other numbers work? ... if n is a go
by bumbledraven 3y ago
This is the most in-depth analysis of Marsaglia's mental PRNG I've seen.
A question, though. The author writes:
> So what other numbers work? ... if n is a good multiplier, then the period of the orbit starting from 1 should be 10n − 2.
> (2 3 6 11 15 18 23 27 38 39 42 50 51 62 66 71)
> The last interesting number is 18. It has a respectable period of 178 and has every possible digit transition. The downside is that you have to learn the 18 times-table. This isn’t too bad: I internalized it with maybe 10 minutes of practice.
Why is 18 the "last" interesting number? The largest number on the list, 71, has a period of 708 (10n − 2). Given that he is willing to memorize the first 10 multiples of a 2-digit number, why didn't he choose 71 over 18, which has a period of only 178?
The 2-digit transitions for 71 are pretty evenly distributed:
7 7 7 7 7 7 7 7 7 7
7 8 7 7 7 7 7 7 7 7
7 7 8 7 7 7 7 7 7 7
7 7 7 8 7 7 7 7 7 7
7 7 7 7 8 7 7 7 7 7
7 7 7 7 7 8 7 7 7 7
7 7 7 7 7 7 8 7 7 7
7 7 7 7 7 7 7 8 7 7
7 7 7 7 7 7 7 7 8 7
7 7 7 7 7 7 7 7 7 7