piecewise_linear_distribution::piecewise_linear_distribution
Constructs the distribution.
piecewise_linear_distribution();
template<class InIt1, class InIt2>
piecewise_linear_distribution(InIt1 first1, InIt1 last1,
InIt2 first2);
template<class Fn>
piecewise_linear_distribution(size_t count,
double low, double high, Fn func);
explicit piecewise_linear_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 values 1.0 and 1.0.
The second constructor constructs an object whose stored value stored_x is initialized with the sequence [first1, last1). stored_p is initialized with stored_x.size() elements beginning at first2.
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.
The fourth constructor constructs an object whose stored parameters are initialized from par0.
In all cases, if the sequence has fewer than two elements, stored_x has two elements RealType(0.0) and RealType(1.0), and stored_p has two elements with value 1. Also, stored_p is normalized so that the sum of all probability intervals is 1.
Requirements
Header: <random>
Namespace: std