Random number generators in C++: it matters
06 Jun 2022Previously, I learned about how in C++11 there are distribution generators (normal, uniform, etc.). The code examples for using those distributions used the std::default_random_engine
as the engine for the distribution.
HOWEVER
std::default_random_engine
is not really a random or even pseudo-random generator. From the docs,
It is the library implemention’s selection of a generator that provides at least acceptable engine behavior for relatively casual, inexpert, and/or lightweight use.
There are a bunch of other generators though, see the list.
Much better for my purposes was to choose std::random_device
, docs.