Gromacs
2024.3
|
#include <gromacs/random/uniformintdistribution.h>
Uniform integer distribution.
The C++ standard library does provide this distribution, but even though they all sample from the correct distribution different standard library implementations appear to return different sequences of numbers for the same random number generator. To make it easier to use GROMACS unit tests that depend on random numbers we have our own implementation.
IntType | Integer type, int by default. |
Classes | |
class | param_type |
Uniform int distribution parameters. More... | |
Public Types | |
typedef IntType | result_type |
Type of values returned. | |
Public Member Functions | |
UniformIntDistribution (result_type a=0, result_type b=std::numeric_limits< result_type >::max()) | |
Construct new distribution with given integer parameters. More... | |
UniformIntDistribution (const param_type ¶m) | |
Construct new distribution from parameter class. More... | |
void | reset () |
Flush all internal saved values. | |
template<class Rng > | |
result_type | operator() (Rng &g) |
Return values from uniform int distribution with internal parameters. More... | |
template<class Rng > | |
result_type | operator() (Rng &g, const param_type ¶m) |
Return value from uniform int distribution with given parameters. More... | |
result_type | a () const |
Return the lower range uniform int distribution. | |
result_type | b () const |
Return the upper range of the uniform int distribution. | |
param_type | param () const |
Return the full parameter class of the uniform int distribution. | |
result_type | min () const |
Smallest value that can be returned from uniform int distribution. | |
result_type | max () const |
Largest value that can be returned from uniform int distribution. | |
bool | operator== (const UniformIntDistribution &x) const |
True if two uniform int distributions will produce the same values. More... | |
bool | operator!= (const UniformIntDistribution &x) const |
True if two uniform int distributions will produce different values. More... | |
|
inlineexplicit |
Construct new distribution with given integer parameters.
a | Lower end of range (inclusive) |
b | Upper end of range (inclusive) |
|
inlineexplicit |
Construct new distribution from parameter class.
param | Parameter class as defined inside gmx::UniformIntDistribution. |
|
inline |
True if two uniform int distributions will produce different values.
x | Instance to compare with. |
|
inline |
Return values from uniform int distribution with internal parameters.
Rng | Uniform random engine class |
g | Random engine |
|
inline |
Return value from uniform int distribution with given parameters.
Rng | Uniform random engine class |
g | Random engine |
param | Parameters to use |
|
inline |
True if two uniform int distributions will produce the same values.
x | Instance to compare with. |