Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

piecewise_constant_distribution Class

Generates a piecewise constant distribution.

template<class RealType = double>
    class piecewise_constant_distribution {
    typedef RealType result_type;
    struct param_type;
    template<class InIt1, class InIt2>
        piecewise_constant_distribution(InIt1 first1, InIt1 last1,
            InIt2 first2);
    template<class Fn>
        piecewise_constant_distribution(size_t count,
            double low, double high, Fn func);
    explicit piecewise_constant_distribution(const param_type& par0);
    std::vector<double> densities() const;
    std::vector<RealType> intervals() 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);
    std::vector<double> stored_p;
    std::vector<RealType> stored_x;




The floating-point result type.

This template class describes a distribution that produces values of a user-specified floating-point type distributed according to a varying-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 has varying-width intervals with uniform probability in each interval.

  • A piecewise_linear_distribution has varying-width intervals with linearly varying probability over each interval.

Header: <random>

Namespace: std

© 2014 Microsoft. All rights reserved.