absl::discrete_distribution::discrete_distribution

Constructors

Synopses

Declared in <absl/random/discrete_distribution.h>

Constructs a distribution with a single, certain outcome.

discrete_distribution();
» more...

Constructs a distribution from a list of weights.

explicit
discrete_distribution(std::initializer_list<double> weights);
» more...

Constructs a distribution from the given parameter set.

explicit
discrete_distribution(param_type const& p);
» more...

Constructs a distribution from a range of weights.

template<typename InputIterator>
explicit
discrete_distribution(
    InputIterator begin,
    InputIterator end);
» more...

Constructs a distribution by sampling a weight function.

template<class UnaryOperation>
explicit
discrete_distribution(
    size_t nw,
    double xmin,
    double xmax,
    UnaryOperation fw);
» more...

Parameters

NameDescription
weightsThe weights of the possible outcomes.
pThe parameter set.
beginAn iterator to the first weight.
endAn iterator past the last weight.
nwThe number of weights to generate.
xminThe lower bound of the sampled interval.
xmaxThe upper bound of the sampled interval.
fwThe unary weight function to sample.