RandomLib
1.10
|
The following routines return random integers of the given type uniformly distributed in [min, max]. These are member functions of Random. Here IntType is any integer type, b, the bitcount, is an integer, w = Random::width. For the a 32-bit (resp. 64-bit) random generator, result_type is an unsigned int (resp. unsigned long long int) and w = 32 (resp. 64). The "C" in IntegerC stands for "closed".
routine | type | min | max |
---|---|---|---|
Integer<IntType, b>() | IntType | 0 | 2b − 1 |
Integer<b>() | unsigned | 0 | 2b − 1 |
Integer(); | unsigned | 0 | std::numeric_limits<unsigned>::max() |
Integer<IntType>() | IntType | std::numeric_limits<IntType>::min() | std::numeric_limits<IntType>::max() |
Boolean() | bool | false | true |
Integer<IntType>(IntType n) | IntType | 0 | n − 1 (if n = 0, std::numeric_limits<IntType>::max(); if n < 0, 0) |
IntegerC<IntType>(IntType n) | IntType | 0 | n (if n < 0, 0) |
IntegerC<IntType>(IntType m, IntType n) | IntType | m | n (if n < m, m) |
operator()() | Random::result_type | 0 | 2w − 1 |
operator()(result_type n) | Random::result_type | 0 | n − 1 (if n = 0, std::numeric_limits<result_type>::max()) |
Here are some examples of calling these routines