discrete_distribution(); | (1) | (since C++11) |
template< class InputIt > discrete_distribution( InputIt first, InputIt last ); | (2) | (since C++11) |
discrete_distribution( std::initializer_list<double> weights ); | (3) | (since C++11) |
template< class UnaryOperation > discrete_distribution( std::size_t count, double xmin, double xmax, UnaryOperation unary_op ); | (4) | (since C++11) |
explicit discrete_distribution( const param_type& params ); | (5) | (since C++11) |
Constructs a new distribution object.
0
.[
first
,
last
)
. If first == last
, the effects are the same as of the default constructor.weights
. Effectively calls discrete_distribution(weights.begin(), weights.end())
.count
weights that are generated using function unary_op
. Each of the weights is equal to wxmin
and xmax
must be such that δ > 0. If count == 0
the effects are the same as of the default constructor.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 InputIterator must be convertible to double |
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:
The signature does not need to have |
params | - | the distribution parameter set |
Type requirements | ||
-InputIt must meet the requirements of LegacyInputIterator. |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/numeric/random/discrete_distribution/discrete_distribution