Constructors

Synopses

Declared in <absl/random/discrete_distribution.h>

Constructs a distribution with a single, certain outcome.

Constructs a distribution from a list of weights.

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

Constructs a distribution from the given parameter set.

explicit
discrete_distribution(param_type const& p);

Constructs a distribution from a range of weights.

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

Constructs a distribution by sampling a weight function.

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

Parameters

Name

Description

weights

The weights of the possible outcomes.

p

The parameter set.

begin

An iterator to the first weight.

end

An iterator past the last weight.

nw

The number of weights to generate.

xmin

The lower bound of the sampled interval.

xmax

The upper bound of the sampled interval.

fw

The unary weight function to sample.

Created with MrDocs