comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Eachus <rieachus@comcast.net>
Subject: Re: Ada.Numerics.Float_Random.Generator question
Date: Sat, 1 Oct 2016 07:23:01 -0700 (PDT)
Date: 2016-10-01T07:23:01-07:00	[thread overview]
Message-ID: <d7983af7-1eef-44b9-aedd-c177c104460e@googlegroups.com> (raw)
In-Reply-To: <87bmz43ejx.fsf@jester.gateway.pace.com>

On Friday, September 30, 2016 at 11:59:15 PM UTC-4, Paul Rubin wrote:
> Robert Eachus <rieachus@comcast.net> writes:
> >> aren't *all* PRNGs cyclic?
> > No, a simple counter-example is a generator that uses the digits of
> > pi.  The digits of any transcendental number will do. 
> 
> I don't see how this would work--to never cycle, it would need infinite
> internal state.  You could consider the digits of pi to be part of the
> state, but to count off the digits, you need a counter of infinite
> width.

A quick proof that a PRNG that never cycles requires infinite state:  If the generator ever returns to a previous state?  It cycles.

But there is infinite state, and infinite state.  An infinite state that is a simple counter of the number of values returned is probably acceptable, a generator that requires storing the whole sequence is not.  (Hmm.  The generators in http://www.cs.ox.ac.uk/people/jeremy.gibbons/publications/spigot.pdf for Pi have a state of k integers for some k.  Of course, these are unbounded integers which will eventually require an array of finite integers to represent.  (Multiprecision arithmetic)  I think that is acceptable.

However, there is another problem with using the digits (binary, decimal, or hexadecimal) of Pi.  There is only one such sequence, so every program that uses it should start where other programs (in particular reruns of the same simulation) left off.  Choosing an n, then calulating ln n or e^n provides a seed that can be different for each run.

Is this discussion more than just idle chatter?  I think so.  Some of the spigot algorithms Paul Rubin points to are practical, given the speed of machines today.  Even if they are not quite, you can use a transcendental PRNG to seed a very long period non-trancendental generator every k values. Also more practical, if you are running a simulation on thousands of CPU cores, you can use a trancendental PRNG to seed each CPUs PRNG, or better reseed every n steps of the simulation.  (Note that you do not need to distribute the new seeds, they can be generated locally.  Again, a trancendental generator with a parameter or parameters is the next thing to look for. ;-)

  reply	other threads:[~2016-10-01 14:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-17 19:40 Ada.Numerics.Float_Random.Generator question Andrew Shvets
2016-09-17 20:09 ` J-P. Rosen
2016-09-17 20:14   ` Andrew Shvets
2016-09-17 21:01 ` Jeffrey R. Carter
2016-09-17 23:53   ` Andrew Shvets
2016-09-19 19:07 ` rieachus
2016-09-25 23:41 ` brbarkstrom
2016-09-26 13:04   ` Robert Eachus
2016-09-26 18:48     ` brbarkstrom
2016-09-29  9:42       ` Some Dude
2016-10-01  3:35         ` Robert Eachus
2016-10-01  3:59           ` Paul Rubin
2016-10-01 14:23             ` Robert Eachus [this message]
2016-10-01 15:49               ` Dmitry A. Kazakov
2016-10-01 16:44                 ` Robert Eachus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox