Share via


discrete_distribution::discrete_distribution

Constructs the distribution.

discrete_distribution();
template<class Fn>
    discrete_distribution(size_t count,
        double low, double high, Fn func);
explicit discrete_distribution(const param_type& par0);

Parameters

  • count
    The number of elements in the distribution range.

  • low
    The lowest value in the distribution range.

  • high
    The highest value in the distribution range.

  • func
    The object representing the probability function for the distribution.

  • par0
    The parameter package used to construct the distribution.

Remarks

The first constructor constructs an object whose stored value stored_p has one element with value 1.

The second constructor constructs an object whose stored value stored_p is initialized with count elements. It divides the range high - low into count uniform subranges, then stores in element I the value func(x) for x in the middle of subrange I. If count < 1, stored_p has one element with value 1.

The third constructor constructs an object whose stored parameters are initialized from par0.

Requirements

Header: <random>

Namespace: std

See Also

Reference

<random>

discrete_distribution Class

Other Resources

<random> Members