subtract_with_carry Class
Generuje losowe przez odejmowanie za pomocą algorytmu carry.Zachowane zgodności TR1.Użyj subtract_with_carry_engine Class zamiast.
template<class IntType,
IntType M, int S, int R>
class subtract_with_carry {
public:
typedef IntType result_type;
typedef subtract_with_carry<IntType, M, S, R> _Myt;
static const IntType modulus = M;
static const IntType default_seed = 19780503U;
static const int short_lag = S;
static const int long_lag = R;
subtract_with_carry();
explicit subtract_with_carry(unsigned long x0 = default_seed);
template<class Gen>
subtract_with_carry(Gen& gen);
subtract_with_carry(const subtract_with_carry& right);
subtract_with_carry(subtract_with_carry& 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
IntType
Typ wyniku całkowitą.M
Parametr m 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 integralną przy użyciu relacji ponownego x(i) = (x(i - R) - x(i - S) - cy(i - 1)) mod M, gdzie cy(i) ma wartość 1 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 ostatniego R - M wartości materiału siewnego.
Argument szablonu IntType musi być wystarczająco duży, aby pomieścić do wartości M - 1.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