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

Class template bernoulli_distribution

Boost , The Boost C++ Libraries BoostBook Documentation Subset , 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::random::bernoulli_distribution

Synopsis

// In header: <boost/random/bernoulli_distribution.hpp>
template<typename RealType = double> 
class bernoulli_distribution {
public:
  // types
  typedef int  input_type; 
  typedef bool result_type;
  // member classes/structs/unions
  class param_type {
  public:
    // types
    typedef bernoulli_distribution distribution_type;
    // construct/copy/destruct
    explicit param_type(RealType = 0.5);
    // public member functions
    RealType p() const;
    // friend functions
    template<typename CharT, typename Traits> 
      friend std::basic_ostream< CharT, Traits > & 
      operator<<(std::basic_ostream< CharT, Traits > &, const param_type &);
    template<typename CharT, typename Traits> 
      friend std::basic_istream< CharT, Traits > & 
      operator>>(std::basic_istream< CharT, Traits > &, const param_type &);
    friend bool operator==(const param_type &, const param_type &);
    friend bool operator!=(const param_type &, const param_type &);
  };
  // construct/copy/destruct
  explicit bernoulli_distribution(const RealType & = 0.5);
  explicit bernoulli_distribution(const param_type &);
  // public member functions
  RealType p() const;
  bool min() const;
  bool max() const;
  param_type param() const;
  void param(const param_type &);
  void reset();
  template<typename Engine> bool operator()(Engine &) const;
  template<typename Engine> 
    bool operator()(Engine &, const param_type &) const;
  // friend functions
  template<typename CharT, typename Traits> 
    friend std::basic_ostream< CharT, Traits > & 
    operator<<(std::basic_ostream< CharT, Traits > &, 
               const bernoulli_distribution &);
  template<typename CharT, typename Traits> 
    friend std::basic_istream< CharT, Traits > & 
    operator>>(std::basic_istream< CharT, Traits > &, 
               const bernoulli_distribution &);
  friend bool operator==(const bernoulli_distribution &, 
                         const bernoulli_distribution &);
  friend bool operator!=(const bernoulli_distribution &, 
                         const bernoulli_distribution &);
};

Description

Обоснования шаблона класса bernoulli_distribution модели случайного распределения. Такое случайное распределение производит значения болта, распределенные с вероятностями P(true) = p и P(false) = 1-p. p является параметром распределения.

bernoulli_distribution public construct/copy/destruct

  1. explicitbernoulli_distribution(const& p =);

    Конструирует объект bernoulli_distribution. p является параметром распределения.

    Требуется: 0 <= p <= 1

  2. explicit bernoulli_distribution(const param_type & param);

    Конструкции bernoulli_distribution из его параметров

bernoulli_distribution public member functions

  1. RealType p() const;

    Возврат: параметр "p" распределения.

  2. bool min() const;

    Возвращает наименьшее значение, которое может произвести распределение.

  3. bool max() const;

    Возвращает наибольшее значение, которое может произвести распределение.

  4. param_type param() const;

    Возвращает параметры распределения.

  5. void param(const param_type & param);

    Устанавливает параметры распределения.

  6. void reset();

    Последующие применения распределения не зависят от значений, произведенных каким-либо двигателем до вызова сброса.

  7. templatetypename Engine> booloperator()& eng) const;

    Возврат: случайная вариация, распределенная в соответствии с bernoulli_distribution.

  8. templatetypename Engine> booloperator(Engine & const param_type & param;const;

    Возврат: случайная вариация, распределенная в соответствии с bernoulli_distribution с параметрами, указанными парамом.

bernoulli_distribution friend functions

  1. templatetypename CharT,friendstd,> > > операторbasic_ostream<>const bernoulli_distribution&

    Переписывает параметры распределения на std::ostream.

  2. templatetypename CharT,Traitsstd,CharT> > оператор::Basic_istream<, >>const bernoulli_distribution;
    std::istream
  3. friend boolоператор(const bernoulli_distribution , constbernoulli_distribution & rhs;;

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

  4. friend boolоператор!=const bernoulli_distribution , constbernoulli_distribution & rhs;

    Вернет истинное значение, если два распределения будут производить разные последовательности значений, заданных равными генераторами.


PrevUpHomeNext

Статья Class template bernoulli_distribution раздела The Boost C++ Libraries BoostBook Documentation Subset Reference может быть полезна для разработчиков на c++ и boost.




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



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


реклама


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

Время компиляции файла: 2024-08-30 11:47:00
2025-05-19 19:09:19/0.028971910476685/1