piecewise_constant_distribution Class
Generates a piecewise constant distribution.
template<class RealType = double>
class piecewise_constant_distribution {
public:
typedef RealType result_type;
struct param_type;
piecewise_constant_distribution();
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);
private:
std::vector<double> stored_p;
std::vector<RealType> stored_x;
};
Parameters
Parameter |
Description |
---|---|
RealType |
The floating-point result type. |
Remarks
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.
Requirements
Header: <random>
Namespace: std
See Also
Reference
piecewise_constant_distribution::densities
piecewise_constant_distribution::intervals
piecewise_constant_distribution::operator()
piecewise_constant_distribution::param
piecewise_constant_distribution::param_type
piecewise_constant_distribution::piecewise_constant_distribution