# Modern C++ idoms and recipes

meshell
34.1K views

## Pseudo-random number generation

The random number library provides classes that generate random and pseudo-random numbers. The library contains two types of components:

• Engines, which are generators of random numbers (both pseudo-random number generators, which generate integer sequences with a uniform distribution, and true random number generators if available)
• Distributions which convert the output of random number engines into various statistical distributions

#### Random number engines

All engines (except the random_device) produce integer numbers in a uniform distribution using seed data as entropy source.

#### Random number distributions

Random number distributions post-processe the output of an random number engine in such a way that the resulting output is distributed according to a defined statistical probability density function.

### Example

The follwing example prints the uniform distribution of an random generator.

#### TODO

Play around with different engines and distributions.

play around with different engines and distributions.
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
Online Participants