r/cpp • • May 25 '18

Modern C++ Randomness

http://brnz.org/hbr/?p=1783
0 Upvotes

55 comments sorted by

View all comments

Show parent comments

1

u/render787 May 29 '18

I guess there's nothing too terrible about that.

Is there anything we could do to make sure that if we added another rand with slightly different characteristics that is meant to be "easy easy easy", we don't have the same conversation again in 5 years because of perceived drawbacks of such a PRNG?

Would you want the output of this interface to be standardized and portable, or just the broad characteristics of the algorithm? Would you want to allow stdlib maintainers to change it at will, since no one will be using this unless they don't care too much about the details?

2

u/matthieum May 29 '18

Would you want the output of this interface to be standardized and portable, or just the broad characteristics of the algorithm?

The signature should be standardized, but the underlying algorithm should not matter.

The output should be of relatively good quality, that is the sequence produced should be pass standard randomness tests, but there should be no need to guarantee it is "secure" in any sense of the word (for example, the seed could be the timestamp of the first call).

Would you want to allow stdlib maintainers to change it at will, since no one will be using this unless they don't care too much about the details?

Yes, definitely.

Actually, to enforce that nobody relies on the specifics of the implementation, I would encourage the stdlib maintainers to mix any seed received with a different "pepper" in each new release of the stdlib.

Instability that is not exercised is de-facto stability.

1

u/render787 May 29 '18

Ok, you convinced me :)