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

Class template inversive_congruential_engine

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 inversive_congruential_engine

boost::random::inversive_congruential_engine

Synopsis

// In header: <boost/random/inversive_congruential.hpp>
template<typename IntType, IntType a, IntType b, IntType p> 
class inversive_congruential_engine {
public:
  // types
  typedef IntType result_type;
  // construct/copy/destruct
  inversive_congruential_engine();
  explicit inversive_congruential_engine(IntType);
  template<typename SeedSeq> explicit inversive_congruential_engine(SeedSeq &);
  template<typename It> inversive_congruential_engine(It &, It);
  // public static functions
  static result_type min();
  static result_type max();
  // public member functions
  void seed();
  void seed(IntType);
  template<typename SeedSeq> void seed(SeedSeq &);
  template<typename It> void seed(It &, It);
  IntType operator()();
  template<typename Iter> void generate(Iter, Iter);
  void discard(boost::uintmax_t);
  // friend functions
  template<typename CharT, typename Traits> 
    friend std::basic_ostream< CharT, Traits > & 
    operator<<(std::basic_ostream< CharT, Traits > &, 
               const inversive_congruential_engine &);
  template<typename CharT, typename Traits> 
    friend std::basic_istream< CharT, Traits > & 
    operator>>(std::basic_istream< CharT, Traits > &, 
               const inversive_congruential_engine &);
  friend bool operator==(const inversive_congruential_engine &, 
                         const inversive_congruential_engine &);
  friend bool operator!=(const inversive_congruential_engine &, 
                         const inversive_congruential_engine &);
  // public data members
  static const bool has_fixed_range;
  static const result_type multiplier;
  static const result_type increment;
  static const result_type modulus;
  static const IntType default_seed;
};

Description

Обоснование шаблона класса<inversive_congruential_engine>модельгенератор псевдослучайных чисел. Он использует инверсивный конгруэнтный алгоритм (ICG), описанный в

"Inversive pseudorandom number generators: concepts, results and links", Peter Hellekalek, In: "Proceedings of the 1995 Winter Simulation Conference", C. Alexopoulos, K. Kang, W.R. Lilegdon, and D. Goldsman (editors), 1995, pp. 255-262. inversive_congruential_engine, сея его с семенами по умолчанию.

  • <
    explicitinversive_congruential_engine(IntTypex0);
    >

    Построение<inversive_congruential_engine>, сеяние его с<x0>.

  • <
    template<typenameSeedSeq>
     explicitinversive_congruential_engine(SeedSeq&seq);
    >

    Конструирует<inversive_congruential_engine>, сея его значениями, производимыми призывом к<seq.generate()>.

  • <
    template<typenameIt>inversive_congruential_engine(It&first,Itlast);
    >

    Конструирует<inversive_congruential_engine>, сеет его со значениями, взятыми из диапазона итератора [первый, последний], и сначала корректирует, чтобы указать на элемент после последнего используемого. Если элементов не хватает, бросок<std::invalid_argument>.

    первым и последним должны быть итераторы ввода.

  • inversive_congruential_engine public static functions

    1. <
      staticresult_typemin();
      >
    2. <
      staticresult_typemax();
      >

    inversive_congruential_engine public member functions

    1. <
      voidseed();
      >

      Звонок семени (default_seed)

    2. <
      voidseed(IntTypex0);
      >

      Если c mod m равно нулю, а x0 mod m равно нулю, то значение тока генератора изменяется на 1. В противном случае измените его на x0 mod m. Если c равно нулю, то различные семена в диапазоне [1,m] оставят генератор в различных состояниях. Если c не равно нулю, то диапазон равен [0,m].

    3. <
      template<typenameSeedSeq>voidseed(SeedSeq&seq);
      >

      Семена<inversive_congruential_engine>с использованием значений из SeedSeq.

    4. <
      template<typenameIt>voidseed(It&first,Itlast);
      >

      сеет<inversive_congruential_engine>со значениями, взятыми из диапазона итератора [первый, последний], и корректирует<first>, чтобы указать на элемент после последнего используемого. Если не хватает элементов, бросок<std::invalid_argument>.

      <first>и<last>должны быть входными итераторами.

    5. <
      IntTypeoperator()();
      >

      Возвращает следующий выход генератора.

    6. <
      template<typenameIter>voidgenerate(Iterfirst,Iterlast);
      >

      Заполняет диапазон случайными значениями

    7. <
      voiddiscard(boost::uintmax_tz);
      >

      Улучшает состояние генератора<z>

      .

    inversive_congruential_engine friend functions

    1. <
      template<typenameCharT,typenameTraits>
       friendstd::basic_ostream<CharT,Traits>&
       operator<<(std::basic_ostream<CharT,Traits>&os,
                  constinversive_congruential_engine&x);
      >

      Текстовое представление генератора записывается в<std::ostream>

      .
    2. <
      template<typenameCharT,typenameTraits>
       friendstd::basic_istream<CharT,Traits>&
       operator>>(std::basic_istream<CharT,Traits>&is,
                  constinversive_congruential_engine&x);
      >

      Читает текстовое представление генератора из<std::istream>

      .
    3. <
      friendbooloperator==(constinversive_congruential_engine&x,
                            constinversive_congruential_engine&y);
      >

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

    4. <
      friendbooloperator!=(constinversive_congruential_engine&lhs,
                            constinversive_congruential_engine&rhs);
      >

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


    PrevUpHomeNext

    Статья Class template inversive_congruential_engine раздела 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:23:49/0.0095441341400146/1