Udostępnij za pośrednictwem


subtract_with_carry_01 Class

Generuje losowe odjąć sekwencji przez zmiennoprzecinkowych z carry algorytmu.Zachowane zgodności TR1.Użyj subtract_with_carry_engine Class zamiast.

template<class RealType,
   int W, int S, int R>
   class subtract_with_carry_01 {
public:
   typedef RealType result_type;
   static const int word_size = W;
   static const int short_lag = S;
   static const int long_lag = R;
   subtract_with_carry_01();
   explicit subtract_with_carry_01(unsigned long x0);
   template<class Gen>
      subtract_with_carry_01(Gen& gen);
   subtract_with_carry_01(const subtract_with_carry_01& right);
   subtract_with_carry_01(subtract_with_carry_01& right);
   void seed(unsigned long x0 = 19780503UL);
   template<class Gen>
      void seed(Gen& gen);
   result_type min() const;
   result_type max() const;
   result_type operator()();
   };

Parametry

  • RealType
    Typ wynik zmiennoprzecinkowy.

  • W
    Parametr w silnika.

  • S
    Parametr silnika S.

  • R
    Parametr silnika R.

Uwagi

Szablon klasy decribes proste aparat, który produkuje wartości określone przez użytkownika typu zmiennoprzecinkowego przy użyciu relacji ponownego x(i) = (x(i - R) - x(i - S) - cy(i - 1)) mod 1, gdzie cy(i) ma wartość 2-W Jeśli x(i - S) - x(i - R) - cy(i - 1) < 0, w przeciwnym razie 0.Stan silnika jest ostatnim R Jeśli zwracane wartości operator() została wywołana co najmniej R razy inaczej M wartości, które zostały zwrócone i ostatniaR - Mwartości materiału siewnego.

Argument szablonu RealType musi być wystarczająco duża, aby przechowywać wartości z W frakcji bitów.Wartości argumentów szablonu S i R musi być większa niż 0 i S musi być mniejsza niż R.

Wymagania

Nagłówek: <random>

Obszar nazw: std

Zobacz też

Informacje

<random>

subtract_with_carry Class

subtract_with_carry_01::operator()

subtract_with_carry_01::seed

subtract_with_carry_01::subtract_with_carry_01