template< class InputIt >
discrete_distribution( InputIt first, InputIt last );
discrete_distribution( std::initializer_list<double> weights );
template< class UnaryOperation >
discrete_distribution( std::size_t count, double xmin, double xmax,
explicit discrete_distribution( const param_type& params );
Constructs a new distribution object.
1) Default constructor. Constructs the distribution with weights . This distribution will always generate 0.
2) Constructs the distribution with weights in the range
[first, last). If first == last, the effects are the same as of the default constructor.
3) Constructs the distribution with weights in
weights. Effectively calls discrete_distribution(weights.begin(), weights.end()).
countweights that are generated using function
unary_op. Each of the weights is equal to w
i = unary_op(xmin + δ/2 + i · δ), where δ =
|(xmax − xmin)|
xmaxmust be such that δ > 0. If count == 0 the effects are the same as of the default constructor.
5) Constructs the distribution with
params as the distribution parameters.
|first, last||-|| the range of elements defining the numbers to use as weights. The type of the elements referred by |
|weights||-||initializer list containing the weights|
|unary_op||-|| unary operation function object that will be applied. |
The signature of the function should be equivalent to the following:
Ret fun(const Type &a);
The signature does not need to have const &.
|params||-||the distribution parameter set|