Of the use of unpredictableSeed

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Sun Mar 5 16:25:59 PST 2017


On Sun, Mar 05, 2017 at 10:30:29AM -0500, Andrei Alexandrescu via Digitalmars-d wrote:
[...]
> Another good thing pointed by the article would be to use the Mersenne
> twister for unpredictableSeed, which would make it difficult to infer
> the sequence from a few samples. Please share if that would be a good
> thing to do.
[...]

Wait, isn't that missing the point?

I thought the whole point of the article was that you shouldn't be using
unpredictableSeed as your PRNG.  It's only supposed to give a
random-enough value to get your chosen PRNG into a (hopefully)
unpredictable initial state. But you should be using values from the
PRNG, not from unpredictableSeed!  Otherwise that's totally missing the
point.

It's possible to use unpredictableSeed for occasionally reseeding your
PRNG, but that should be quite infrequent.  If you find yourself
reseeding your PRNG every other minute, or worse, every time you call
your PRNG, then you're doing something very, very wrong.

Using the Mersenne twister to generate unpredictableSeed seems to me to
be completely backwards.  It should be the other way round: the value of
unpredictableSeed should be random enough to be suitable for seeding a
Mersenne twister algorithm, so that it will start off the algorithm in a
random initial state (and you should be getting values from the
algorithm thereafter, not from unpredictableSeed).


T

-- 
Unix is my IDE. -- Justin Whear


More information about the Digitalmars-d mailing list