Compartir a través de


subtract_with_carry Class

Genera una secuencia aleatoria por el restar con contienen el algoritmo.Retenido por compatibilidad TR1.Utilice subtract_with_carry_engine Class en su lugar.

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

Parámetros

  • IntType
    el tipo de resultado entero.

  • M
    El parámetro del motor de m.

  • S
    El parámetro del motor de s.

  • R
    El parámetro del motor de r.

Comentarios

La clase de plantilla describe un motor simple que genere valores entero definido por el usuario escribe utilizando la relación de frecuencia x(i) = (x(i - R) - x(i - S) - cy(i - 1)) mod M, donde cy(i) tiene el valor 1 si x(i - S) - x(i - R) - cy(i - 1) < 0, si no 0.El estado del motor son valores de R el último devueltos si operator() se ha llamado al menos los tiempos de R , si no los valores de M se han devuelto y valores pasados de R - M seed.

El argumento IntType template debería ser lo bastante grande para contener valores hasta M - 1.Los valores de los argumentos S y R de plantilla deben ser mayores que 0 y S debe ser menor que R.

Requisitos

encabezado: <aleatorio>

espacio de nombres: std

Vea también

Referencia

<random>

subtract_with_carry_01 Class

subtract_with_carry::operator()

subtract_with_carry::seed

subtract_with_carry::subtract_with_carry