The C++11 standard specifies a number of different engines for random number generation: linear_congruential_engine
, mersenne_twister_engine
,
Its a trade-off really. A PRNG like Mersenne Twister
is better because it has extremely large period and other good statistical properties.
But a large period PRNG takes up more memory (for maintaining the internal state) and also takes more time for generating a random number (due to complex transitions and post processing).
Choose a PNRG depending on the needs of your application. When in doubt use Mersenne Twister
, its the default in many tools.