共用方式為


subtract_with_carry_01 Class

由浮點產生隨機序列減去使用帶有演算法。 保留為 TR1 相容性。 請改用 subtract_with_carry_engine Class

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()();
   };

參數

  • RealType
    浮點結果型別。

  • W
    W 引擎的參數。

  • S
    S 引擎的參數。

  • R
    R 引擎的參數。

備註

樣板類別描述使用遞迴關聯性 x(i) = (x(i - R) - x(i - S) - cy(i - 1)) mod 1,會產生使用者定義的浮點型別的值, cy(i) 具有值 2-W ,如果 x(i - S) - x(i - R) - cy(i - 1) < 0,則為 0的簡單的引擎。 引擎的狀態會傳回的最後一個 R 值,如果 operator() 呼叫至少 R 時間,則傳回的 M 值和最後一個 R - M 的種子值。

樣板引數 RealType 必須夠大表示與 W 分數的位元值。 樣板引數 S 和 R 的值 S 大於 0 且必須小於 R必須大於零。

需求

標題: <random>

命名空間: std

請參閱

參考

<random>

subtract_with_carry Class

subtract_with_carry_01::operator()

subtract_with_carry_01::seed

subtract_with_carry_01::subtract_with_carry_01