Celeritas
0.5.0-56+6b053cd
|
Select one of two options with a given probability. More...
#include <BernoulliDistribution.hh>
Public Types | |
Type aliases | |
using | result_type = bool |
Public Member Functions | |
CELER_FUNCTION | BernoulliDistribution (real_type p_true) |
Construct with the probability of returning true. | |
CELER_FUNCTION | BernoulliDistribution (real_type scaled_true, real_type scaled_false) |
Construct with the UNnormalized probability of returning true or false. | |
template<class Generator > | |
CELER_FUNCTION result_type | operator() (Generator &rng) |
real_type | p () const |
Probability of returning true from operator() | |
template<class Generator > | |
CELER_FUNCTION auto | operator() (Generator &rng) -> result_type |
Construct with the probability of returning true. | |
Select one of two options with a given probability.
The constructor argument is the chance of returning true
, with an optional second argument for normalizing with a fraction of false
values.