Celeritas 0.7+ef734374e
Loading...
Searching...
No Matches
Public Member Functions | List of all members
celeritas::RoundedNonnegDistribution< Distribution, IntType > Class Template Reference

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.
 

Detailed Description

template<class Distribution, class IntType = celeritas::size_type>
class celeritas::RoundedNonnegDistribution< Distribution, IntType >

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).


The documentation for this class was generated from the following file: