# Random number generation in C++

C++ TR1 has code for generting random samples from normal, exponential, gamma, and Poisson distributions directly. Random number generation using C++ TR1 explains how to use this built-in functionality and now to bootstrap the built-in functions to generate samples from Cauchy, Student-t, Snedecor-F, and Weibull distributions.

However, if for some reason you cannot use TR1 and need **stand-alone**
random number generation code in C++, you may use the class `SimpleRNG`

.
The source files are here: SimpleRNG.h, SimpleRNG.cpp.

The C++ implementation of `SimpleRNG`

is based on the C# class by the
same name explained in the article Simple Random Number Generation.

SimpleRNG can be used to generate random unsigned integers and double values with several statistical distributions:

- Beta
- Cauchy
- Chi square
- Exponential
- Gamma
- Inverse gamma
- Laplace (double exponential)
- Log normal
- Normal
- Student t
- Uniform
- Weibull

Related links:

Pitfalls in Random Number Generation

Distribution chart

Stand-alone numerical code