Random number generation

suggest change

Remarks

Random number generation in C++ is provided by the <random> header. This header defines random devices, pseudo-random generators and distributions.

std::random_device is the standard hook for non-deterministic entropy when the implementation has it. entropy() may be 0, and the type is not required to be cryptographically secure. It is normally used to seed a pseudo-random generator.

The named pseudo-random engines return integer pseudo-random numbers based on their initial seed. The pseudo-random number range typically spans all values of an unsigned type. Those engines, unlike std::default_random_engine, return the same numbers for the same initial seed on every platform.

Distributions consume random numbers from pseudo-random generators or random devices and produce random numbers with necessary distribution. Distributions are not platform-independent and can produce different numbers for the same generators with the same initial seeds on different platforms.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents