|
Celeritas 0.7+ef734374e
|
Sample from a distribution and return a rounded non-negative integer. More...
#include <RoundedNonnegDistribution.hh>
Public Types | |
Type aliases | |
| using | real_type = typename Distribution::real_type |
| using | result_type = IntType |
Public Member Functions | |
| template<class... Args> | |
| RoundedNonnegDistribution (Args &&... args) | |
| Construct with arguments forwarded to the wrapped distribution. | |
| template<class Generator > | |
| result_type | operator() (Generator &rng) |
| template<class Generator > | |
| auto | operator() (Generator &rng) -> result_type |
| Sample a random number according to the rounded non-negative distribution. | |
Sample from a distribution and return a rounded non-negative integer.
This distribution wraps an arbitrary underlying sampler and rounds each value to the nearest integer by adding 0.5 and truncating. Negative values are clamped to zero. The underlying distribution MUST NOT return a value greater than the maximum representable value of the integer type (i.e., don't use this to sample the number of atoms in a gram of substance).