discrete_distribution Class

Generates a discrete integer distribution.

template<class IntType = int>
    class discrete_distribution {
public:
    typedef IntType result_type;
    struct param_type;
    discrete_distribution();
    explicit discrete_distribution(const param_type& par0);
    template<class Fn>
        discrete_distribution(size_t count,
            double low, double high, Fn func);
    explicit discrete_distribution(const param_type& par0);
    std::vector<double> probabilities() const;
    param_type param() const;
    void param(const param_type& par0);
    result_type min() const;
    result_type max() const;
    void reset();
    template<class Engine>
        result_type operator()(Engine& eng);
    template<class Engine>
        result_type operator()(Engine& eng,
            const param_type& par0);
private:
    std::vector<double> stored_p;
    };

Parameters

Parameter

Description

IntType

The integer result type.

Remarks

This template class describes a <random> that produces values of a user-specified integral type distributed according to a uniform-width histogram of probabilities.

Three distributions are very similar:

Requirements

Header: <random>

Namespace: std

See Also

Reference

<random>

discrete_distribution::discrete_distribution

discrete_distribution::operator()

discrete_distribution::param

discrete_distribution::param_type

discrete_distribution::probabilities

Other Resources

<random> Members