Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

Class template bernoulli_distribution

Boost , Chapter 1. Boost.Compute , Reference

Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Class template bernoulli_distribution

boost::compute::bernoulli_distribution — Produces random boolean values according to the following discrete probability function with parameter p : P(true/p) = p and P(false/p) = (1 - p)

Synopsis

// In header: <boost/compute/random/bernoulli_distribution.hpp>
template<typename RealType = float> 
class bernoulli_distribution {
public:
  // construct/copy/destruct
  bernoulli_distribution(RealType = 0.5f);
  ~bernoulli_distribution();
  // public member functions
  RealType p() const;
  template<typename OutputIterator, typename Generator> 
    void generate(OutputIterator, OutputIterator, Generator &, 
                  command_queue &);
  // private member functions
   BOOST_STATIC_ASSERT_MSG(boost::is_floating_point< RealType >::value, 
                           "Template argument must be a floating point type");
};

Description

Следующий пример показывает, как настроить распределение бернулли для получения случайных булевых значений с параметром p = 0,25.


bernoulli_distribution public construct/copy/destruct

  1. <
    bernoulli_distribution(RealTypep=0.5f);
    >Создает новое распределение бернулли.
  2. <
    ~bernoulli_distribution();
    >Уничтожение объекта<bernoulli_distribution>.

bernoulli_distribution public member functions

  1. <
    RealTypep()const;
    >Возвращает значение параметра p.
  2. <
    template<typenameOutputIterator,typenameGenerator>
     voidgenerate(OutputIteratorfirst,OutputIteratorlast,
                   Generator&generator,command_queue&queue);
    >

    Генерирует бернулли, распределяет булевы и хранит их в ассортименте [<first>,<last>.

bernoulli_distribution private member functions

  1. <
    BOOST_STATIC_ASSERT_MSG(boost::is_floating_point<RealType>::value,
                            "Template argument must be a floating point type");
    >

PrevUpHomeNext

Статья Class template bernoulli_distribution раздела Chapter 1. Boost.Compute Reference может быть полезна для разработчиков на c++ и boost.




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Reference ::


реклама


©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru

Время компиляции файла: 2024-08-30 11:47:00
2025-05-19 20:16:48/0.0064120292663574/0