subtract_with_carry_engine Class
由減去產生隨機序列使用帶有演算法。
template<class UIntType,
int W, int S, int R>
class subtract_with_carry_engine {
public:
typedef UIntType result_type;
static const int word_size = W;
static const int short_lag = S;
static const int long_lag = R;
static const UIntType default_seed = 19780503U;
explicit subtract_with_carry_engine(UIntType x0 = default_seed);
explicit subtract_with_carry_engine(seed_seq& seq);
void seed(UIntType x0 = default_seed);
void seed(seed_seq& seq);
static const result_type min();
static const result_type max();
result_type operator()();
void discard(unsigned long long count)();
};
參數
UIntType
整數結果型別。W
M 引擎的參數。S
S 引擎的參數。R
R 引擎的參數。
備註
使用遞迴關聯性 x(i) = (x(i - R) - x(i - S) - cy(i - 1)) mod M,會產生使用者指定不帶正負號的整數類資料型別的值, cy(i) 具有值 1 的樣板類別描述 簡單的引擎 ,如果 x(i - S) - x(i - R) - cy(i - 1) < 0、則為 0和 M 具有值 2W。(請注意樣板參數這裡 W 取代 subtract_with_carry樣板參數 M )。引擎的狀態為帶有顯示加上 R 值。這些值包括傳回的最後一個 R 值,如果 operator() 呼叫至少 R 時間,則傳回的 N 值和種子的最後一個 R - N 值。
樣板引數 UIntType 必須夠大保留的值。 M - 1決策。樣板引數 S 和 R 的值 S 大於 0 且必須小於 R必須大於零。
需求
標題: <random>
命名空間: std
請參閱
參考
subtract_with_carry_engine::discard
subtract_with_carry_engine::operator()