12#ifndef ARCANE_CORE_RANDOM_TKISS_H
13#define ARCANE_CORE_RANDOM_TKISS_H
17#include "arcane/utils/FatalErrorException.h"
19#include "arcane/core/random/RandomGlobal.h"
24namespace Arcane::random
38template <
typename UIntType, UIntType val>
43 typedef UIntType result_type;
44 typedef UIntType state_type;
45 static const bool has_fixed_range =
true;
46 static const result_type min_value = 0;
47 static const result_type max_value = 4294967295U;
57 result_type
min()
const {
return min_value; }
67 result_type
max()
const {
return max_value; }
77 explicit TKiss(UIntType x0 = 30903, UIntType y0 = 30903, UIntType z0 = 30903, UIntType w0 = 30903, UIntType carry0 = 0)
114 for (
Integer i = 0; i < 4; i++)
127 void seed(UIntType x0, UIntType y0, UIntType z0, UIntType w0, UIntType carry0)
157 _state[0] = _state[0] * 69069 + 1;
158 _state[1] ^= _state[1] << 13;
159 _state[1] ^= _state[1] >> 17;
160 _state[1] ^= _state[1] << 5;
162 t = (_state[3] << 1) + _state[2] + _state[4];
163 _state[4] = ((_state[2] >> 2) + (_state[3] >> 3) + (_state[4] >> 2)) >> 30;
164 _state[2] = _state[3];
166 return (_state[0] + _state[1] + _state[2]);
189 return (_state[0] == rhs._state[0]) && (_state[1] == rhs._state[1]) && (_state[2] == rhs._state[2]) && (_state[3] == rhs._state[3]) && (_state[4] == rhs._state[4]);
194 state_type _state[5];
200typedef TKiss<UInt32, 0> Kiss;
result_type min() const
Returns the minimum possible value of a sequence.
void seed(UIntType x0)
Initialization of the seed array from the value x0. The seed array of this generator consists of five...
UIntType getState(Integer i) const
Method that returns the i-th component of the generator state. The complete generator state is given ...
void seed(UIntType x0, UIntType y0, UIntType z0, UIntType w0, UIntType carry0)
Initialization of the seed array from the argument values.
UIntType operator()()
Overdefinition of the () operator which returns the pseudo-random value. The generator state is modif...
void seed(UIntType *state)
Initialization of the seed array from the state. The generator state state must consist of five eleme...
TKiss(UIntType x0=30903, UIntType y0=30903, UIntType z0=30903, UIntType w0=30903, UIntType carry0=0)
Constructor with initialization of the seed array from the argument values.
result_type max() const
Returns the maximum possible value of a sequence.
bool validation(UIntType x) const
Validation function (I don't know what it's for!).
bool operator==(const TKiss &rhs) const
Overdefinition of the == operator.
Int32 Integer
Type representing an integer.