pcg-cpp icon indicating copy to clipboard operation
pcg-cpp copied to clipboard

Seed securely by default

Open o11c opened this issue 8 years ago • 0 comments

If seed (or, for extended generators data - it's fine to omit stream) is omitted for any given constructor/seed call, the sanest default is to seed from /dev/urandom by default. Only allow an insecurely-initialized RNG if some singleton enum is explicitly passed in place of the relevant argument.

This is a breaking change, but appropriate use of macros can let people hide if if they really need to. But chances are if it breaks anything, it was a bug in their code.

Note that the testsuite does rely on selfinit since it never passes data. But I don't like that. (I've replaced TWO_ARG_INIT with ARG_INIT_COUNT which can take any value from 0 to 3 (or conceptually more) and passes exactly that many arguments to RNG's constructor)

o11c avatar Oct 05 '17 03:10 o11c