Class template discrete_distribution
boost::compute::discrete_distribution — Produces random integers on the interval [0, n), where probability of each integer is given by the weight of the ith integer divided by the sum of all weights.
Synopsis
Description
Следующий пример показывает, как настроить дискретное распределение для получения 0 и 1 с равной вероятностью.
discrete_distribution
public
construct/copy/destruct
- <
discrete_distribution();
>Создает новое дискретное распределение с одним весом p = {1}. Такое распределение дает только нули.
- <
template<typenameInputIterator>
discrete_distribution(InputIteratorfirst,InputIteratorlast);
>Создает новое дискретное распределение с весами, заданными диапазоном [<first
>,<last
>].
- <
~discrete_distribution();
>Уничтожает<discrete_distribution
>объект.
discrete_distribution
public member functions
- <
::std::vector<double>probabilities()const;
>Возвращает вероятности.
- <
result_typeminBOOST_PREVENT_MACRO_SUBSTITUTION()const;
>Возвращает минимальное потенциально генерируемое значение.
- <
result_typemaxBOOST_PREVENT_MACRO_SUBSTITUTION()const;
>Возвращает максимальное потенциально генерируемое значение.
- <
template<typenameOutputIterator,typenameGenerator>
voidgenerate(OutputIteratorfirst,OutputIteratorlast,
Generator&generator,command_queue&queue);
>Генерирует равномерно распределенные целые числа и сохраняет их в диапазоне<first
>,<last
>.
discrete_distribution
private member functions
- <
BOOST_STATIC_ASSERT_MSG(boost::is_integral<IntType>::value,
"Template argument must be integral");
>