piecewise_constant_distribution::piecewise_constant_distribution
Constructs the distribution.
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);
Parameters
first1
An input iterator addressing the position of the first element in the distribution range.last1
An input iterator addressing the position of the last element in the distribution range.first2
An input iterator addressing the position of the first element in the new distribution range.count
The number of elements in the distribution range.low
The lowest value in the distribution range.high
The highest value in the distribution range.func
The object representing the probability function for the distribution.par0
The parameter package used to construct the distribution.
Remarks
Precondition: All elements to be stored in stored_p are nonnegative and at least one is nonzero.
The first constructor constructs an object whose stored value stored_x holds the values RealType(0.0) and RealType(1.0), and whose stored value stored_p holds the value 1.0.
The second constructor constructs an object whose stored value stored_x is initialized with the sequence [first1, last1). If the sequence has fewer than two elements, stored_x has two elements RealType(0.0) and RealType(1.0), and stored_p has one element with value 1. Otherwise, stored_p is initialized with stored_x.size() - 1 elements beginning at first2, then normalized so that the sum of all elements is 1.
The third constructor constructs an object whose stored value stored_p is initialized with count elements. It divides the range high - low into count subranges, then stores in element I the value func(x) for x in the middle of subrange I. It stores in stored_x the count + 1 endpoints of these subranges. If count < 1, stored_p has one element with value 1.
The fourth constructor constructs an object whose stored parameters are initialized from par0.
Requirements
Header: <random>
Namespace: std
See Also
Reference
piecewise_constant_distribution Class