Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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:
A discrete_distribution has uniform-width intervals with uniform probability in each interval.
A piecewise_constant_distribution Class has varying-width intervals with uniform probability in each interval.
A piecewise_linear_distribution Class has varying-width intervals with linearly varying probability over each interval.
Requirements
Header: <random>
Namespace: std
See Also
Reference
discrete_distribution::discrete_distribution
discrete_distribution::operator()