C++ Logo


Advanced search

Re: Comments for P0205 and P2060: Mersenne twister can actually generate 7 and 13

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Fri, 19 Nov 2021 12:05:32 -0500
On Fri, Nov 19, 2021 at 11:56 AM Dimitrij Mijoski via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> On Fri, 2021-11-19 at 10:15 -0500, Jason McKesson via Std-Proposals
> wrote:
> > On Fri, Nov 19, 2021 at 9:51 AM Dimitrij Mijoski via Std-Proposals
> > <std-proposals_at_[hidden]> wrote:
> > >
> > > This is just one more argument that that "test", i.e. distribution of
> > > the first outputs after seeding, is not a good test for the quality
> > > of any PRNG. The P in PRNG has meaning, of course they are not
> > > perfect, they are pseudo-random. They are designed to give uniformity
> > > after multiple calls after seeding. See my previous comment here
> > > https://lists.isocpp.org/std-proposals/2021/11/3354.php
> >
> > The idea that you shouldn't expect reasonable randomness from an RNG
> > until you prime the pump by extracting some number of random bits from
> > it is ridiculous. That's the *entire point* of seeding the RNG: to
> > prime the pump so that you can get good randomness from the first bit
> > you extract.
> But there is good randomness, who said it isn't good? Do you trust a
> random article on the internet with a lot of unproven claims and
> without a method to replicate their false results? I already proved
> that it contains wrong information. Please give a proof with code that
> measures the distribution of the first outputs after seeding of various
> different PRNGs, and then make your claims.
> > His point is pretty straightforward. If an RNG has a gigantic seed,
> > then that's a problem with the RNG, not with the person wanting to
> > fill up *whatever* seed an RNG has. Logically, it makes no sense not
> > to fill up the entire RNG seed.
> >
> > And note, we're not taking away the ability to pick however much
> > randomness you want. We're making it easier to fill up the entirety of
> > the seed with randomness. You're effectively saying that people
> > shouldn't want that, but the only reason not to do it is because some
> > RNGs have gigantic seeds. He's saying that this is a problem with the
> > RNG, not with the concept of filling up the seed entirely.
> >
> You are not making a difference between seed and state. If the PRNG
> state is huge, the seed does not need to be huge. And yes I'm saying
> that people should not want the seed to be always the same size as the
> internal state.

For the purposes of this conversation, the seed and the state are the
same thing. The state cannot contain more randomness than the RNG was
seeded with. If you only provide, say, 16 bits of randomness as a
seed, the RNG will only ever have 2^16 possible sequences from that
16-bit initial seed. It cannot manufacture 2^32 sequences.

It should be easy to shove as much randomness at an RNG as possible.
If a particular user wants to seed it with only 32-bits of randomness,
they can. If a particular user wants to seed it with only 128 bits of
randomness, they can. But it should not be needlessly difficult to
seed an RNG with *all* of the randomness it can take.

Nobody is stopping a person from picking whatever works for them. What
we're doing is making it easy to do the simplest, most obvious thing:
seed an RNG with all of the randomness it can take. If someone picks
an RNG that has a ludicrously large seed, and that's a performance
problem for them, they can pick a different RNG or adjust their seed

Received on 2021-11-19 11:05:48