C++ Logo

std-proposals

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 13:08:52 -0500
On Fri, Nov 19, 2021 at 12:18 PM Dimitrij Mijoski via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> On Fri, 2021-11-19 at 12:05 -0500, Jason McKesson via Std-Proposals
> wrote:
> > 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.
>
> Maybe. But it should not be easy to do that with std::random_device
> because as I said, overusing it is wrong. It is a depleatable resource.

I get the idea that calling `random_device` 624 times for 32-bits at a
time is not necessarily a good idea. But maybe we should be teaching
people not to use RNGs that have 624-integer seeds instead of making
it harder for people to use RNGs with more reasonable seed sizes.

Or we could split the difference by allowing the user to provide an
integer number for the maximum number of values to extract from
`random_device`. Maybe even make providing the integer mandatory.

Received on 2021-11-19 12:09:05