Dconf 2015 talks...

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 8 12:38:57 PST 2016


On Monday, 8 February 2016 at 19:46:19 UTC, Joseph Rushton 
Wakeling wrote:
> [snip]

This might be a stupid idea, but perhaps there's something useful 
in it:

Determinism isn't the same thing as "one long chain of numbers 
that everybody reads from".

It can be acceptable to seed a set of reasonable pseudo-random 
number generators with consecutive integers (indeed seeding 
randomly can be dangerous because of the birthday problem). More 
generally, any change of the state of the rng in "seed-space" 
should produce an output equivalent to taking a sample from the 
output distribution.

Can you not have a random number generator make a copy of itself 
like this:

struct RNG
{
     State state;
     static State.ModifierT modifier;
     this(this)
     {
         this.state.alterBy(modifier++);
         //recalculate output sample etc...
     }
}

Then any time you copy a RNG, the copy is kicked on to a new path 
in state-space. Basically we're deterministically re-seeding on 
copy.


More information about the Digitalmars-d mailing list