22 #define UINT64_C(c) static_cast<uint64_t>(c)
37 this->
state =
new uint64_t[4];
42 for (
int i=0; i < 4; ++i)
58 if (this->
state != NULL)
77 const uint64_t t = this->
state[1] << 17;
102 static const uint64_t JUMP[] = {
113 for (
unsigned int i = 0; i <
sizeof(JUMP) /
sizeof(*JUMP); ++i)
115 for (
int b = 0; b < 64; ++b)
119 s0 ^= this->
state[0];
120 s1 ^= this->
state[1];
121 s2 ^= this->
state[2];
122 s3 ^= this->
state[3];
147 static const uint64_t LONG_JUMP[] = {
158 for (
unsigned int i = 0; i <
sizeof(LONG_JUMP) /
sizeof(*LONG_JUMP); ++i)
160 for (
int b = 0; b < 64; ++b)
162 if (LONG_JUMP[i] &
UINT64_C(1) << b)
164 s0 ^= this->
state[0];
165 s1 ^= this->
state[1];
166 s2 ^= this->
state[2];
167 s3 ^= this->
state[3];
196 return (x << k) | (x >> (64 - k));
Pseudo-random integer generator. This class generates 64-bit integer using SplitMix64 algorithm.
uint64_t next()
Generates the next presudo-random number in the sequence.
Xoshiro256StarStar(const int64_t seed)
Constructor. It initializes the state variable with random integers using splitmix64 pseudo-random ge...
static uint64_t rotation_left(const uint64_t x, int k)
Rotates the bits of a 64 bit integer toward left.
void long_jump()
Long jump function for the generator. It is equivalent to 2^192 calls to next(). It can be used to ge...
uint64_t next()
Generates the next presudo-random number.
~Xoshiro256StarStar()
Destructor.
void jump()
Jump function for the generator. It is equivalent to 2^128 calls to next(); it can be used to generat...