Back to Compiling all the examples. Forward to Examples using u-rands. Up to Contents. The classes defined fall into the following categories
- C++11 random distributions
These offer the simplest interfaces. The operator() methods of these classes take a random number engine as an argument.
- Classes returning u-rands (shorten "distribution" to "dist" in the class names above)
These offer the flexibility of returning the random deviate as a u-rand, selecting the base uses for the u-rand, etc. The C++11 random distributions are defined in terms of these. These classes need a digit generator (see below) passed to them when there are constructed.
- The class for the u-rand
Besides implementing the simple operations required for u-rands, this class contains a method, u_rand::value, which allows the u-rand to be extracted as a floating-point number, using any rounding mode. It also provides methods for printing u-rands. This is constructed with a digit generator.
- The class for partially sampling integers from a uniform range
This is the integer counterpart to u_rand and is used to improve the efficiency of discrete_normal_dist. This is constructed with a digit generator.
- The digit generators
This is the machinery used to convert the results of a random number engine into a stream of random digits. For diagnostic purposes, it also keeps count of the number of digits produced. The xxx_dist, u_rand, and i_rand classes are all instantiated with a reference to a digit generator (and frequently they share the same digit generator so that the counts are aggregated). Most of the methods in these classes then take a random number engine as an argument for the digit generator to use. Usually the first class, rand_digit, should be used. This can use any of the C++11 random generator engines as the source of randomness and so works much like std::uniform_int_distribution(0,base-1). The second class uses ...
- A class to allow use of tabulated random numbers in [0,9]
This takes a string of digits in the constructor and returns one digit at a time, throwing an exception when the string runs out.
- Low level functionality for manipulating bases
This allows the use of base = 2^{32} which typically overflows the unsigned type used for digits. It can also report whether the base is a power of two.
- A helper class
which isn't really part of the library; but it provides function to return properties of the implemented distributions for use in the testing and diagnostics.
- Finally,
uses Kahn's method of sampling from the normal distribution. This is a possible replacement for unit_normal_dist. Note however that overflow can occur in this implementation which results in a slight bias in the random deviates. For this reason, this class is deprecated.
Back to Compiling all the examples. Forward to Examples using u-rands. Up to Contents.