| Home | Libraries | People | FAQ | More

## Reference

### Concepts

#### Introduction

Random numbers are required in a number of different problem domains, such as

- numerics (simulation, Monte-Carlo integration)
- games (non-deterministic enemy behavior)
- security (key generation)
- testing (random coverage in white-box tests)

The Boost Random Number Generator Library provides a framework for random number generators with well-defined properties so that the generators can be used in the demanding numerics and security domains. For a general introduction to random numbers in numerics, see

> "Numerical Recipes in C: The art of scientific computing", William H. Press, Saul A. Teukolsky, William A. Vetterling, Brian P. Flannery, 2nd ed., 1992, pp. 274-328

Depending on the requirements of the problem domain, different variations of random number generators are appropriate:

- non-deterministic random number generator
- pseudo-random number generator
- quasi-random number generator

All variations have some properties in common, the concepts (in the STL sense) is called UniformRandomNumberGenerator. This concept will be defined in a subsequent section.

The goals for this library are the following:

- allow easy integration of third-party random-number generators
- provide easy-to-use front-end classes which model popular distributions
- provide maximum efficiency

#### Uniform Random Number Generator

A uniform random number generator provides a sequence of random numbers uniformly distributed on a given range. The range can be compile-time fixed or available (only) after run-time construction of the object.

The tight lower bound of some (finite) set S is the (unique) member l in S, so that for all v in S, l <= v holds. Likewise, the tight upper bound of some (finite) set S is the (unique) member u in S, so that for all v in S, v <= u holds.

In the following table, X denotes a number generator class returning objects of type T, and v is a const value of X.

Table 34.1. UniformRandomNumberGenerator requirements

expression | return type | pre/post-condition
--- | --- | ---
`X::result_type` | `T` | `std::numeric_limits<T>::is_specialized` is `true`, `T` is LessThanComparable
`u.operator()()` | `T` | -
`v.min()` | `T` | tight lower bound on the set of all values returned by `operator()`. The return value of this function shall not change during the lifetime of the object.
`v.max()` | `T` | if `std::numeric_limits<T>::is_integer`, tight upper bound on the set of all values returned by `operator()`, otherwise, the smallest representable number larger than the tight upper bound on the set of all values returned by `operator()`. In any case, the return value of this function shall not change during the lifetime of the object.

The member functions `min`, `max`, and `operator()` shall have amortized constant time complexity.

| Note
For integer generators (i.e. integer `T`), the generated values `x` fulfill `min() <= x <= max()`, for non-integer generators (i.e. non-integer `T`), the generated values `x` fulfill `min() <= x < max()`. Rationale: The range description with min and max serves two purposes. First, it allows scaling of the values to some canonical range, such as [0..1). Second, it describes the significant bits of the values, which may be relevant for further processing. The range is a closed interval [min,max] for integers, because the underlying type may not be able to represent the half-open interval [min,max+1). It is a half-open interval [min, max) for non-integers, because this is much more practical for borderline cases of continuous distributions.

| Note
The UniformRandomNumberGenerator concept does not require `operator()(long)` and thus it does not fulfill the `RandomNumberGenerator` (std:25.2.11 [lib.alg.random.shuffle]) requirements. Use the `random_number_generator` adapter for that. Rationale: `operator()(long)` is not provided, because mapping the output of some generator with integer range to a different integer range is not trivial.

#### Non-deterministic Uniform Random Number Generator

A non-deterministic uniform random number generator is a UniformRandomNumberGenerator that is based on some stochastic process. Thus, it provides a sequence of truly-random numbers. Examples for such processes are nuclear decay, noise of a Zehner diode, tunneling of quantum particles, rolling a die, drawing from an urn, and tossing a coin. Depending on the environment, inter-arrival times of network packets or keyboard events may be close approximations of stochastic processes.

The class `random_device` is a model for a non-deterministic random number generator.

| Note
This type of random-number generator is useful for security applications, where it is important to prevent an outside attacker from guessing the numbers and thus obtaining your encryption or authentication key. Thus, models of this concept should be cautious not to leak any information, to the extent possible by the environment. For example, it might be advisable to explicitly clear any temporary storage as soon as it is no longer needed.

#### Pseudo-Random Number Generator

A pseudo-random number generator is a UniformRandomNumberGenerator which provides a deterministic sequence of pseudo-random numbers, based on some algorithm and internal state. `Linear congruential` and `inversive congruential` generators are examples of such pseudo-random number generators. Often, these generators are very sensitive to their parameters. In order to prevent wrong implementations from being used, an external testsuite should check that the generated sequence and the validation value provided do indeed match.

Donald E. Knuth gives an extensive overview on pseudo-random number generation in his book "The Art of Computer Programming, Vol. 2, 3rd edition, Addison-Wesley, 1997". The descriptions for the specific generators contain additional references.

| Note
Because the state of a pseudo-random number generator is necessarily finite, the sequence of numbers returned by the generator will loop eventually.

In addition to the UniformRandomNumberGenerator requirements, a pseudo-random number generator has some additional requirements. In the following table, `X` denotes a pseudo-random number generator class, `u` is a value of `X`, `i` is a value of integral type, `s` is a value of a type which models SeedSeq, and `j` a value of type `unsigned long long`.

Table 34.2. PseudoRandomNumberGenerator requirements

expression | return type | pre/post-condition
--- | --- | ---
`X()` | - | creates a generator with a default seed.
`X(i)` | - | creates a generator seeding it with the integer `i`.
`X(s)` | - | creates a generator setting its initial state from the SeedSeq `s`.
`u.seed(...)` | `void` | sets the current state to be identical to the state that would be created by the corresponding constructor.
`u.discard(j)` | `void` | Advances the generator by `j` steps as if by `j` calls to `u()`.

Classes which model a pseudo-random number generator shall also model EqualityComparable, i.e. implement `operator==`. Two pseudo-random number generators are defined to be equivalent if they both return an identical sequence of numbers starting from a given state.

Classes which model a pseudo-random number generator shall also model the Streamable concept, i.e. implement `operator<<` and `operator>>`. `operator<<` writes all current state of the pseudo-random number generator to the given `ostream` so that `operator>>` can restore the state at a later time. The state shall be written in a platform-independent manner, but it is assumed that the `locales` used for writing and reading be the same. The pseudo-random number generator with the restored state and the original at the just-written state shall be equivalent.

Classes which model a pseudo-random number generator should also model the CopyConstructible and Assignable concepts. However, note that the sequences of the original and the copy are strongly correlated (in fact, they are identical), which may make them unsuitable for some problem domains. Thus, copying pseudo-random number generators is discouraged; they should always be passed by (non-const) reference.

The classes `rand48`, `minstd_rand`, and `mt19937` are models for a pseudo-random number generator.

| Note
This type of random-number generator is useful for numerics, games and testing. The non-zero arguments constructor(s) and the `seed()` member function(s) allow for a user-provided state to be installed in the generator. This is useful for debugging Monte-Carlo algorithms and analyzing particular test scenarios. The Streamable concept allows to save/restore the state of the generator, for example to re-run a test suite at a later time.

#### Quasi-Random Number Generator

A quasi-random number generator is a UniformRandomNumberGenerator which provides a deterministic sequence of quasi-random numbers, based on some algorithm and internal state. `Niederreiter base 2` generator is an example of such a quasi-random number generator. The "quasi" modifier is used to denote more clearly that the values produced by such a generator are neither random nor pseudo-random, but they form a low discrepancy sequence. The intuitive idea is that a low discrepancy sequence is more evenly distributed than a pseudo random sequence would be. For example, if we generate a low discrepancy sequence of 2D points on a square, this square would be covered more evenly, and the number of points falling to any part of the square would be proportional to the number of points in the whole square. Such sequences share some properties of random variables and in certain applications such as the quasi-Monte Carlo method their lower discrepancy is an important advantage.

| Note
The quasi-Monte Carlo method uses a low-discrepancy sequence such as the Niederreiter base 2 sequence, the Sobol sequence, or the Faure sequence among the others. The advantage of using low-discrepancy sequences is a probabilistically faster rate of convergence. Quasi-Monte Carlo has a rate of convergence O(log(N)s/N), whereas the rate of convergence for the Monte Carlo method, which uses a pseudo-random sequence, is O(N-0.5).

Harold Niederreiter gives an extensive overview on random number generation and quasi-Monte Carlo methods in his book "Random number generation and quasi-Monte Carlo methods, Society for Industrial and Applied Mathematics, 1992".

In addition to the UniformRandomNumberGenerator requirements, a quasi-random number generator has some additional requirements. In the following table, `X` denotes a quasi-random number generator class, `u` is a value of `X`, `v` is a const value of `X`, and `j` a value of type `unsigned long long`.

Table 34.3. QuasiRandomNumberGenerator requirements

expression | return type | pre/post-condition
--- | --- | ---
`X(s)` | - | creates an `s`-dimensional generator with a default seed. Dimension `s` is an integer no less than 1.
`v.dimension()` | std::size_t | the dimension of quasi-random domain.
`u.seed(i)` | `void` | seeds the generator with the integer `i`.
`u.discard(j)` | `void` | Advances the generator by `j` steps as if by `j` calls to `u()`.

| Note
The `operator()` returns a successive element of an `s`-dimensional (`s` = `v.dimension()`) vector at each invocation. When all elements are exhausted, `operator()` begins anew with the starting element of a subsequent `s`-dimensional vector.

Classes which model a quasi-random number generator shall also model EqualityComparable, i.e. implement `operator==`. Two quasi-random number generators are defined to be equivalent if they both return an identical sequence of numbers starting from a given state.

Classes which model a quasi-random number generator shall also model the Streamable concept, i.e. implement `operator<<` and `operator>>`. `operator<<` writes all current state of the quasi-random number generator to the given `ostream` so that `operator>>` can restore the state at a later time. The state shall be written in a platform-independent manner, but it is assumed that the `locales` used for writing and reading be the same. The quasi-random number generator with the restored state and the original at the just-written state shall be equivalent.

Classes which model a quasi-random number generator should also model the CopyConstructible and Assignable concepts. However, note that the sequences of the original and the copy are strongly correlated (in fact, they are identical), which may make them unsuitable for some problem domains. Thus, copying quasi-random number generators is discouraged; they should always be passed by (non-const) reference.

The classes `niederreiter_base2`, `sobol`, `faure` are models for a quasi-random number generator.

#### Seed Sequence

A SeedSeq represents a sequence of values that can be used to set the initial state of a PseudoRandomNumberGenerator. `i` and `j` are RandomAccessIterators whose `value_type` is an unsigned integer type with at least 32 bits.

Table 34.4. SeedSeq requirements

expression | return type | pre/post-condition | complexity
--- | --- | --- | ---
`s.generate(i, j)` | void | stores 32-bit values to all the elements in the iterator range defined by `i` and `j` | O(j - i)

The class `seed_seq` and every UniformRandomNumberGenerator provided by the library are models of SeedSeq.

#### Random Distribution

A random distribution produces random numbers distributed according to some distribution, given uniformly distributed random values as input. In the following table, `X` denotes a random distribution class returning objects of type `T`, `u` is a value of `X`, `x` and `y` are (possibly const) values of `X`, `P` is the `param_type` of the distribution, `p` is a value of `P`, and `e` is an lvalue of an arbitrary type that meets the requirements of a UniformRandomNumberGenerator, returning values of type `U`.

Table 34.5. Random distribution requirements (in addition to CopyConstructible, and Assignable)

expression | return type | pre/post-condition | complexity
--- | --- | --- | ---
`X::result_type` | `T` | - | compile-time
`X::param_type` | `P` | A type that stores the parameters of the distribution, but not any of the state used to generate random variates. `param_type` provides the same set of constructors and accessors as the distribution. | compile-time
`X(p)` | `X` | Initializes a distribution from its parameters | O(size of state)
`u.reset()` | `void` | subsequent uses of `u` do not depend on values produced by any engine prior to invoking `reset`. | constant
`u(e)` | `T` | the sequence of numbers returned by successive invocations with the same object `e` is randomly distributed with the probability density function of the distribution | amortized constant number of invocations of `e`
`u(e, p)` | `T` | Equivalent to X(p)(e), but may use a different (and presumably more efficient) implementation | amortized constant number of invocations of `e` + O(size of state)
`x.param()` | `P` | Returns the parameters of the distribution | O(size of state)
`x.param(p)` | void | Sets the parameters of the distribution | O(size of state)
`x.min()` | `T` | returns the minimum value of the distribution | constant
`x.max()` | `T` | returns the maximum value of the distribution | constant
`x == y` | `bool` | Indicates whether the two distributions will produce identical sequences of random variates if given equal generators | O(size of state)
`x != y` | `bool` | `!(x == y)` | O(size of state)
`os << x` | `std::ostream&` | writes a textual representation for the parameters and additional internal data of the distribution `x` to `os`. post: The `os.fmtflags` and fill character are unchanged. | O(size of state)
`is >> u` | `std::istream&` | restores the parameters and additional internal data of the distribution `u`. pre: `is` provides a textual representation that was previously written by `operator<<` post: The `is.fmtflags` are unchanged. | O(size of state)

Additional requirements: The sequence of numbers produced by repeated invocations of `x(e)` does not change whether or not `os << x` is invoked between any of the invocations `x(e)`. If a textual representation is written using `os << x` and that representation is restored into the same or a different object `y` of the same type using `is >> y`, repeated invocations of `y(e)` produce the same sequence of random numbers as would repeated invocations of `x(e)`.

### Generators

This library provides several pseudo-random number generators. The quality of a pseudo random number generator crucially depends on both the algorithm and its parameters. This library implements the algorithms as class templates with template value parameters, hidden in `namespace boost::random`. Any particular choice of parameters is represented as the appropriately specializing `typedef` in `namespace boost`.

Pseudo-random number generators should not be constructed (initialized) frequently during program execution, for two reasons. First, initialization requires full initialization of the internal state of the generator. Thus, generators with a lot of internal state (see below) are costly to initialize. Second, initialization always requires some value used as a "seed" for the generated sequence. It is usually difficult to obtain several good seed values. For example, one method to obtain a seed is to determine the current time at the highest resolution available, e.g. microseconds or nanoseconds. When the pseudo-random number generator is initialized again with the then-current time as the seed, it is likely that this is at a near-constant (non-random) distance from the time given as the seed for first initialization. The distance could even be zero if the resolution of the clock is low, thus the generator re-iterates the same sequence of random numbers. For some applications, this is inappropriate.

Note that all pseudo-random number generators described below are CopyConstructible and Assignable. Copying or assigning a generator will copy all its internal state, so the original and the copy will generate the identical sequence of random numbers. Often, such behavior is not wanted. In particular, beware of the algorithms from the standard library such as `std::generate`. They take a functor argument by value, thereby invoking the copy constructor when called.

The following table gives an overview of some characteristics of the generators. The cycle length is a rough estimate of the quality of the generator; the approximate relative speed is a performance measure, higher numbers mean faster random number generation.

Table 34.6. generators

generator | length of cycle | approx. memory requirements | approx. speed compared to fastest | comment
--- | --- | --- | --- | ---
`minstd_rand0` | 231-2 | `sizeof(int32_t)` | 16% | -
`minstd_rand` | 231-2 | `sizeof(int32_t)` | 16% | -
`rand48` | 248-1 | `sizeof(uint64_t)` | 64% | -
`ecuyer1988` | approx. 261 | `2*sizeof(int32_t)` | 7% | -
`knuth_b` | ? | `257*sizeof(uint32_t)` | 12% | -
`kreutzer1986` | ? | `98*sizeof(uint32_t)` | 37% | -
`taus88` | ~288 | `3*sizeof(uint32_t)` | 100% | -
`hellekalek1995` | 231-1 | `sizeof(int32_t)` | 2% | good uniform distribution in several dimensions
`mt11213b` | 211213-1 | `352*sizeof(uint32_t)` | 100% | good uniform distribution in up to 350 dimensions
`mt19937` | 219937-1 | `625*sizeof(uint32_t)` | 93% | good uniform distribution in up to 623 dimensions
`mt19937_64` | 219937-1 | `312*sizeof(uint64_t)` | 38% | good uniform distribution in up to 311 dimensions
`lagged_fibonacci607` | ~232000 | `607*sizeof(double)` | 59% | -
`lagged_fibonacci1279` | ~267000 | `1279*sizeof(double)` | 59% | -
`lagged_fibonacci2281` | ~2120000 | `2281*sizeof(double)` | 61% | -
`lagged_fibonacci3217` | ~2170000 | `3217*sizeof(double)` | 62% | -
`lagged_fibonacci4423` | ~2230000 | `4423*sizeof(double)` | 59% | -
`lagged_fibonacci9689` | ~2510000 | `9689*sizeof(double)` | 61% | -
`lagged_fibonacci19937` | ~21050000 | `19937*sizeof(double)` | 59% | -
`lagged_fibonacci23209` | ~21200000 | `23209*sizeof(double)` | 61% | -
`lagged_fibonacci44497` | ~22300000 | `44497*sizeof(double)` | 59% | -
`ranlux3` | ~10171 | `24*sizeof(int)` | 5% | -
`ranlux4` | ~10171 | `24*sizeof(int)` | 3% | -
`ranlux64_3` | ~10171 | `24*sizeof(int64_t)` | 5% | -
`ranlux64_4` | ~10171 | `24*sizeof(int64_t)` | 3% | -
`ranlux3_01` | ~10171 | `24*sizeof(float)` | 5% | -
`ranlux4_01` | ~10171 | `24*sizeof(float)` | 3% | -
`ranlux64_3_01` | ~10171 | `24*sizeof(double)` | 5% | -
`ranlux64_4_01` | ~10171 | `24*sizeof(double)` | 3% | -
`ranlux24` | ~10171 | `24*sizeof(uint32_t)` | 5% | -
`ranlux48` | ~10171 | `12*sizeof(uint64_t)` | 3% | -

As observable from the table, there is generally a quality/performance/memory trade-off to be decided upon when choosing a random-number generator. The multitude of generators provided in this library allows the application programmer to optimize the trade-off with regard to his application domain. Additionally, employing several fundamentally different random number generators for a given application of Monte Carlo simulation will improve the confidence in the results.

If the names of the generators don't ring any bell and you have no idea which generator to use, it is reasonable to employ `mt19937` for a start: It is fast and has acceptable quality.

| Note
These random number generators are not intended for use in applications where non-deterministic random numbers are required. See `random_device` for a choice of (hopefully) non-deterministic random number generators.

### Distributions

In addition to the random number generators, this library provides distribution functions which map one distribution (often a uniform distribution provided by some generator) to another.

Usually, there are several possible implementations of any given mapping. Often, there is a choice between using more space, more invocations of the underlying source of random numbers, or more time-consuming arithmetic such as trigonometric functions. This interface description does not mandate any specific implementation. However, implementations which cannot reach certain values of the specified distribution or otherwise do not converge statistically to it are not acceptable.

Table 34.7. Uniform Distributions

distribution | explanation | example
--- | --- | ---
`uniform_smallint` | discrete uniform distribution on a small set of integers (much smaller than the range of the underlying generator) | drawing from an urn
`uniform_int_distribution` | discrete uniform distribution on a set of integers; the underlying generator may be called several times to gather enough randomness for the output | drawing from an urn
`uniform_01` | continuous uniform distribution on the range [0,1); important basis for other distributions | -
`uniform_real_distribution` | continuous uniform distribution on some range [min, max) of real numbers | for the range [0, 2pi): randomly dropping a stick and measuring its angle in radians (assuming the angle is uniformly distributed)

Table 34.8. Bernoulli Distributions

distribution | explanation | example
--- | --- | ---
`bernoulli_distribution` | Bernoulli experiment: discrete boolean valued distribution with configurable probability | tossing a coin (p=0.5)
`binomial_distribution` | counts outcomes of repeated Bernoulli experiments | tossing a coin 20 times and counting how many front sides are shown
`geometric_distribution` | measures distance between outcomes of repeated Bernoulli experiments | throwing a die several times and counting the number of tries until a "6" appears for the first time
`negative_binomial_distribution` | Counts the number of failures of repeated Bernoulli experiments required to get some constant number of successes. | flipping a coin and counting the number of heads that show up before we get 3 tails

Table 34.9. Poisson Distributions

distribution | explanation | example
--- | --- | ---
`poisson_distribution` | poisson distribution | counting the number of alpha particles emitted by radioactive matter in a fixed period of time
`exponential_distribution` | exponential distribution | measuring the inter-arrival time of alpha particles emitted by radioactive matter
`gamma_distribution` | gamma distribution | -
`hyperexponential_distribution` | hyperexponential distribution | service time of k-parallel servers each with a given service rate and probability to be chosen
`weibull_distribution` | weibull distribution | -
`extreme_value_distribution` | extreme value distribution | -
`beta_distribution` | beta distribution | -
`laplace_distribution` | laplace distribution | -

Table 34.10. Normal Distributions

distribution | explanation | example
--- | --- | ---
`normal_distribution` | counts outcomes of (infinitely) repeated Bernoulli experiments | tossing a coin 10000 times and counting how many front sides are shown
`lognormal_distribution` | lognormal distribution (sometimes used in simulations) | measuring the job completion time of an assembly line worker
`chi_squared_distribution` | chi-squared distribution | -
`non_central_chi_squared_distribution` | non-central chi-squared distribution | -
`cauchy_distribution` | Cauchy distribution | -
`fisher_f_distribution` | Fisher F distribution | -
`student_t_distribution` | Student t distribution | -

Table 34.11. Sampling Distributions

distribution | explanation | example
--- | --- | ---
`discrete_distribution` | discrete distribution with specific probabilities | rolling an unfair die
`piecewise_constant_distribution` | - | -
`piecewise_linear_distribution` | - | -

Table 34.12. Miscellaneous Distributions

distribution | explanation | example
--- | --- | ---
`triangle_distribution` | triangle distribution | -
`uniform_on_sphere` | uniform distribution on a unit sphere of arbitrary dimension | choosing a random point on Earth (assumed to be a sphere) where to spend the next vacations

### Utilities

Table 34.13. Utilities

Name | Description
--- | ---
`seed_seq` | Used to seed Random Engines
`random_number_generator` | Adapts a PseudoRandomNumberGenerator to work with std::random_shuffle
`generate_canonical` | Produces random floating point values with specific precision.

### Headers

#### Header <boost/random/additive_combine.hpp>

    namespace boost {
      namespace random {
        template<typename MLCG1, typename MLCG2> class additive_combine_engine;
        typedef additive_combine_engine< linear_congruential_engine< uint32_t, 40014, 0, 2147483563 >, linear_congruential_engine< uint32_t, 40692, 0, 2147483399 >> ecuyer1988;
      }
    }

#### Header <boost/random/bernoulli_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class bernoulli_distribution;
      }
    }

#### Header <boost/random/beta_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class beta_distribution;
      }
    }

#### Header <boost/random/binomial_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename IntType = int, typename RealType = double>
          class binomial_distribution;
      }
    }

#### Header <boost/random/cauchy_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class cauchy_distribution;
      }
    }

#### Header <boost/random/chi_squared_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class chi_squared_distribution;
      }
    }

#### Header <boost/random/discard_block.hpp>

    namespace boost {
      namespace random {
        template<typename UniformRandomNumberGenerator, std::size_t p,
                 std::size_t r>
          class discard_block_engine;
      }
    }

#### Header <boost/random/discrete_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename IntType = int, typename WeightType = double>
          class discrete_distribution;
      }
    }

#### Header <boost/random/exponential_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class exponential_distribution;
      }
    }

#### Header <boost/random/extreme_value_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class extreme_value_distribution;
      }
    }

#### Header <boost/random/faure.hpp>

    namespace boost {
      namespace random {
        template<typename RealType, typename SeqSizeT,
                 typename PrimeTable = default_faure_prime_table>
          class faure_engine;
        typedef faure_engine< double, boost::uint_least64_t, default_faure_prime_table > faure;
      }
    }

#### Header <boost/random/fisher_f_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class fisher_f_distribution;
      }
    }

#### Header <boost/random/gamma_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class gamma_distribution;
      }
    }

#### Header <boost/random/generate_canonical.hpp>

    namespace boost {
      namespace random {
        template<typename RealType, std::size_t bits, typename URNG>
          RealType generate_canonical(URNG &);
      }
    }

#### Header <boost/random/geometric_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename IntType = int, typename RealType = double>
          class geometric_distribution;
      }
    }

#### Header <boost/random/hyperexponential_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealT = double> class hyperexponential_distribution;
      }
    }

#### Header <boost/random/independent_bits.hpp>

    namespace boost {
      namespace random {
        template<typename Engine, std::size_t w, typename UIntType>
          class independent_bits_engine;
      }
    }

#### Header <boost/random/inversive_congruential.hpp>

    namespace boost {
      namespace random {
        template<typename IntType, IntType a, IntType b, IntType p>
          class inversive_congruential_engine;
        typedef inversive_congruential_engine< uint32_t, 9102, 2147483647-36884165, 2147483647 > hellekalek1995;
      }
    }

#### Header <boost/random/lagged_fibonacci.hpp>

    namespace boost {
      namespace random {
        template<typename RealType, int w, unsigned int p, unsigned int q>
          class lagged_fibonacci_01_engine;
        template<typename UIntType, int w, unsigned int p, unsigned int q>
          class lagged_fibonacci_engine;
        typedef lagged_fibonacci_01_engine< double, 48, 607, 273 > lagged_fibonacci607;
        typedef lagged_fibonacci_01_engine< double, 48, 1279, 418 > lagged_fibonacci1279;
        typedef lagged_fibonacci_01_engine< double, 48, 2281, 1252 > lagged_fibonacci2281;
        typedef lagged_fibonacci_01_engine< double, 48, 3217, 576 > lagged_fibonacci3217;
        typedef lagged_fibonacci_01_engine< double, 48, 4423, 2098 > lagged_fibonacci4423;
        typedef lagged_fibonacci_01_engine< double, 48, 9689, 5502 > lagged_fibonacci9689;
        typedef lagged_fibonacci_01_engine< double, 48, 19937, 9842 > lagged_fibonacci19937;
        typedef lagged_fibonacci_01_engine< double, 48, 23209, 13470 > lagged_fibonacci23209;
        typedef lagged_fibonacci_01_engine< double, 48, 44497, 21034 > lagged_fibonacci44497;
      }
    }

#### Header <boost/random/laplace_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class laplace_distribution;
      }
    }

#### Header <boost/random/linear_congruential.hpp>

    namespace boost {
      namespace random {
        template<typename IntType, IntType a, IntType c, IntType m>
          class linear_congruential_engine;
        class rand48;
        typedef linear_congruential_engine< uint32_t, 16807, 0, 2147483647 > minstd_rand0;
        typedef linear_congruential_engine< uint32_t, 48271, 0, 2147483647 > minstd_rand;
      }
    }

#### Header <boost/random/linear_feedback_shift.hpp>

    namespace boost {
      namespace random {
        template<typename UIntType, int w, int k, int q, int s>
          class linear_feedback_shift_engine;
      }
    }

#### Header <boost/random/lognormal_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class lognormal_distribution;
      }
    }

#### Header <boost/random/mersenne_twister.hpp>

    BOOST_RANDOM_MERSENNE_TWISTER_DISCARD_THRESHOLD

    namespace boost {
      namespace random {
        template<typename UIntType, std::size_t w, std::size_t n, std::size_t m,
                 std::size_t r, UIntType a, std::size_t u, UIntType d,
                 std::size_t s, UIntType b, std::size_t t, UIntType c,
                 std::size_t l, UIntType f>
          class mersenne_twister_engine;
        typedef mersenne_twister_engine< uint32_t, 32, 351, 175, 19, 0xccab8ee7, 11, 0xffffffff, 7, 0x31b6ab00, 15, 0xffe50000, 17, 1812433253 > mt11213b;
        typedef mersenne_twister_engine< uint32_t, 32, 624, 397, 31, 0x9908b0df, 11, 0xffffffff, 7, 0x9d2c5680, 15, 0xefc60000, 18, 1812433253 > mt19937;
        typedef mersenne_twister_engine< uint64_t, 64, 312, 156, 31, 0xb5026f5aa96619e9ull, 29, 0x5555555555555555ull, 17, 0x71d67fffeda60000ull, 37, 0xfff7eee000000000ull, 43, 6364136223846793005ull > mt19937_64;
      }
    }

#### Header <boost/random/negative_binomial_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename IntType = int, typename RealType = double>
          class negative_binomial_distribution;
      }
    }

#### Header <boost/random/niederreiter_base2.hpp>

    namespace boost {
      namespace random {
        template<typename UIntType, unsigned w,
                 typename Nb2Table = default_niederreiter_base2_table>
          class niederreiter_base2_engine;
        typedef niederreiter_base2_engine< boost::uint_least64_t, 64u, default_niederreiter_base2_table > niederreiter_base2;
      }
    }

#### Header <boost/random/non_central_chi_squared_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double>
          class non_central_chi_squared_distribution;
      }
    }

#### Header <boost/random/normal_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class normal_distribution;
      }
    }

#### Header <boost/random/piecewise_constant_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double, typename WeightType = double>
          class piecewise_constant_distribution;
      }
    }

#### Header <boost/random/piecewise_linear_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class piecewise_linear_distribution;
      }
    }

#### Header <boost/random/poisson_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename IntType = int, typename RealType = double>
          class poisson_distribution;
      }
    }

#### Header <boost/random/random_device.hpp>

    namespace boost {
      namespace random {
        class random_device;
      }
    }

#### Header <boost/random/random_number_generator.hpp>

    namespace boost {
      namespace random {
        template<typename URNG, typename IntType = long>
          class random_number_generator;
      }
    }

#### Header <boost/random/ranlux.hpp>

    namespace boost {
      namespace random {
        typedef subtract_with_carry_engine< uint32_t, 24, 10, 24 > ranlux_base;
        typedef subtract_with_carry_01_engine< float, 24, 10, 24 > ranlux_base_01;
        typedef subtract_with_carry_01_engine< double, 48, 10, 24 > ranlux64_base_01;
        typedef discard_block_engine< ranlux_base, 223, 24 > ranlux3;
        typedef discard_block_engine< ranlux_base, 389, 24 > ranlux4;
        typedef discard_block_engine< ranlux_base_01, 223, 24 > ranlux3_01;
        typedef discard_block_engine< ranlux_base_01, 389, 24 > ranlux4_01;
        typedef discard_block_engine< ranlux64_base_01, 223, 24 > ranlux64_3_01;
        typedef discard_block_engine< ranlux64_base_01, 389, 24 > ranlux64_4_01;
        typedef subtract_with_carry_engine< uint64_t, 48, 10, 24 > ranlux64_base;
        typedef discard_block_engine< ranlux64_base, 223, 24 > ranlux64_3;
        typedef discard_block_engine< ranlux64_base, 389, 24 > ranlux64_4;
        typedef subtract_with_carry_engine< uint32_t, 24, 10, 24 > ranlux24_base;
        typedef subtract_with_carry_engine< uint64_t, 48, 5, 12 > ranlux48_base;
        typedef discard_block_engine< ranlux24_base, 223, 23 > ranlux24;
        typedef discard_block_engine< ranlux48_base, 389, 11 > ranlux48;
      }
    }

#### Header <boost/random/seed_seq.hpp>

    namespace boost {
      namespace random {
        class seed_seq;
      }
    }

#### Header <boost/random/shuffle_order.hpp>

    namespace boost {
      namespace random {
        template<typename UniformRandomNumberGenerator, std::size_t k>
          class shuffle_order_engine;
        typedef shuffle_order_engine< linear_congruential_engine< uint32_t, 1366, 150889, 714025 >, 97 > kreutzer1986;
        typedef shuffle_order_engine< minstd_rand0, 256 > knuth_b;
      }
    }

#### Header <boost/random/sobol.hpp>

    namespace boost {
      namespace random {
        template<typename UIntType, unsigned w,
                 typename SobolTables = default_sobol_table>
          class sobol_engine;
        typedef sobol_engine< boost::uint_least64_t, 64u, default_sobol_table > sobol;
      }
    }

#### Header <boost/random/student_t_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class student_t_distribution;
      }
    }

#### Header <boost/random/subtract_with_carry.hpp>

    namespace boost {
      namespace random {
        template<typename RealType, std::size_t w, std::size_t s, std::size_t r>
          class subtract_with_carry_01_engine;
        template<typename IntType, std::size_t w, std::size_t s, std::size_t r>
          class subtract_with_carry_engine;
      }
    }

#### Header <boost/random/taus88.hpp>

    namespace boost {
      namespace random {
        typedef xor_combine_engine< xor_combine_engine< linear_feedback_shift_engine< uint32_t, 32, 31, 13, 12 >, 0, linear_feedback_shift_engine< uint32_t, 32, 29, 2, 4 >, 0 >, 0, linear_feedback_shift_engine< uint32_t, 32, 28, 3, 17 >, 0 > taus88;
      }
    }

#### Header <boost/random/traits.hpp>

    namespace boost {
      namespace random {
        namespace traits {
          template<typename T> struct is_integral;
          template<typename T> struct is_signed;
          template<typename T> struct make_unsigned;
          template<typename T> struct make_unsigned_or_unbounded;
        }
      }
    }

#### Header <boost/random/triangle_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class triangle_distribution;
      }
    }

#### Header <boost/random/uniform_01.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class uniform_01;
      }
    }

#### Header <boost/random/uniform_int_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename IntType = int> class uniform_int_distribution;
      }
    }

#### Header <boost/random/uniform_on_sphere.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double,
                 typename Cont = std::vector<RealType> >
          class uniform_on_sphere;
      }
    }

#### Header <boost/random/uniform_real_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class uniform_real_distribution;
      }
    }

#### Header <boost/random/uniform_smallint.hpp>

    namespace boost {
      namespace random {
        template<typename IntType = int> class uniform_smallint;
      }
    }

#### Header <boost/random/variate_generator.hpp>

    namespace boost {
      template<typename Engine, typename Distribution> class variate_generator;
    }

#### Header <boost/random/weibull_distribution.hpp>

    namespace boost {
      namespace random {
        template<typename RealType = double> class weibull_distribution;
      }
    }

#### Header <boost/random/xor_combine.hpp>

    namespace boost {
      namespace random {
        template<typename URNG1, int s1, typename URNG2, int s2>
          class xor_combine_engine;
      }
    }