I think the Mersenne twister std::mt19937
engine is just fine as the "default" PRNG.
You can just use std::random_device
to get a non-deterministic seed for mt19937
.
There is a very interesting talk from GoingNative 2013 by Stephan T. Lavavej:
You can download the slides as well from that web site. In particular, slide #23 clearly compares mt19937
vs. random_device
:
mt19937
is:
- Fast (499 MB/s = 6.5 cycles/byte for me)
- Extremely high quality, but not cryptographically secure
- Seedable (with more than 32 bits if you want)
- Reproducible (Standard-mandated algorithm)
random_device
is:
- Possibly slow (1.93 MB/s = 1683 cycles/byte for me)
- Strongly platform-dependent (GCC 4.8 can use IVB RDRAND)
- Possibly crypto-secure (check documentation, true for VC)
- Non-seedable, non-reproducible