|
Celeritas 0.7.0-dev.170+develop.df22d2a88
|
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) const |
| real_type | p () const |
Probability of returning true from operator() | |
| template<class Generator > | |
| CELER_FUNCTION auto | operator() (Generator &rng) const -> 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.