Share via


piecewise_linear_distribution Class

Generates a piecewise linear distribution.

template<class RealType = double>
    class piecewise_linear_distribution {
public:
    typedef RealType result_type;
    struct param_type;
    piecewise_linear_distribution();
    template<class InIt1, class InIt2>
        piecewise_linear_distribution(InIt1 first1, InIt1 last1,
            InIt2 first2);
    template<class Fn>
        piecewise_linear_distribution(initializer_list<RealType> init, Fn func);
    template<class Fn>
        piecewise_linear_distribution(size_t count,
            double low, double high, Fn func);
    explicit piecewise_linear_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);
private:
    std::vector<double> stored_p;
    std::vector<RealType> stored_x;
    };

Parameters

Parameter

Description

RealType

The floating-point result type.

Remarks

The template class describes a distribution that produces values of a user-specified floating-point type distributed according to a varying-width histogram of probabilities, with probability varying linearly over each interval.

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.

Requirements

Header: <random>

Namespace: std

See Also

Reference

<random>

piecewise_linear_distribution::densities

piecewise_linear_distribution::intervals

piecewise_linear_distribution::operator()

piecewise_linear_distribution::param

piecewise_linear_distribution::param_type

piecewise_linear_distribution::piecewise_linear_distribution

Other Resources

<random> Members