thrust::random::subtract_with_carry_engine
Defined in thrust/random/subtract_with_carry_engine.h
- 
template<typename UIntType, size_t w, size_t s, size_t r>
 class subtract_with_carry_engine
- A - subtract_with_carry_enginerandom number engine produces unsigned integer random numbers using the subtract with carry algorithm of Marsaglia & Zaman.- The generation algorithm is performed as follows: - Let - Y = X_{i-s}- X_{i-r} - c.
- Set - X_ito- y = T mod m. Set- cto- 1if- Y < 0, otherwise set- cto- 0.
 - This algorithm corresponds to a modular linear function of the form - TA(x_i) = (a * x_i) mod b, where- bis of the form- m^r - m^s + 1and- a = b - (b-1)/m.- See also - See also - Note - Inexperienced users should not use this class template directly. Instead, use - ranlux24_baseor- ranlux48_base, which are instances of- subtract_with_carry_engine.- Template Parameters
- UIntType – The type of unsigned integer to produce. 
- w – The word size of the produced values ( - w <= sizeof(UIntType)).
- s – The short lag of the generation algorithm. 
- r – The long lag of the generation algorithm. 
 
 - Public Types - 
typedef UIntType result_type
- The type of the unsigned integer produced by this - subtract_with_carry_engine.
 - Public Functions - 
explicit subtract_with_carry_engine(result_type value = default_seed)
- This constructor, which optionally accepts a seed, initializes a new - subtract_with_carry_engine.- Parameters
- value – The seed used to initialize this - subtract_with_carry_engine'sstate.
 
 - 
void seed(result_type value = default_seed)
- This method initializes this - subtract_with_carry_engine'sstate, and optionally accepts a seed value.- Parameters
- value – The seed used to initializes this - subtract_with_carry_engine'sstate.
 
 - 
result_type operator()(void)
- This member function produces a new random value and updates this - subtract_with_carry_engine'sstate.- Returns
- A new random number. 
 
 - 
void discard(unsigned long long z)
- This member function advances this - subtract_with_carry_engine'sstate a given number of times and discards the results.- Note - This function is provided because an implementation may be able to accelerate it. - Parameters
- z – The number of random values to discard. 
 
 - Public Static Attributes - 
static const result_type min = 0
- The smallest value this - subtract_with_carry_enginemay potentially produce.
 - 
static const result_type max = modulus - 1
- The largest value this - subtract_with_carry_enginemay potentially produce.
 - 
static const result_type default_seed = 19780503u
- The default seed of this - subtract_with_carry_engine.