imate
C++/CUDA Reference
|
Pseudo-random integer generator. This class generates 64-bit integer using Xoshiro256** algorithm. More...
#include <xoshiro_256_star_star.h>
Public Member Functions | |
Xoshiro256StarStar (const int64_t seed) | |
Constructor. It initializes the state variable with random integers using splitmix64 pseudo-random generator. More... | |
~Xoshiro256StarStar () | |
Destructor. More... | |
uint64_t | next () |
Generates the next presudo-random number. More... | |
void | jump () |
Jump function for the generator. It is equivalent to 2^128 calls to next() ; it can be used to generate 2^128 non-overlapping subsequences for parallel computations. More... | |
void | long_jump () |
Long jump function for the generator. It is equivalent to 2^192 calls to next() . It can be used to generate 2^64 starting points from each of which jump() will generate 2^64 non-overlapping subsequences for parallel distributed computations. More... | |
Static Protected Member Functions | |
static uint64_t | rotation_left (const uint64_t x, int k) |
Rotates the bits of a 64 bit integer toward left. More... | |
Protected Attributes | |
uint64_t * | state |
Pseudo-random integer generator. This class generates 64-bit integer using Xoshiro256** algorithm.
The Xoshiro256** algorithm has 256-bit state space, and passes all statistical tests, including the BigCrush. The state of this class is initialized using SplitMix64
random generator.
A very similar method to Xoshiro256** is Xoshiro256++ which has the very same properties and speed as the Xoshiro256**. An alternative method is Xoshiro256+, which is 15% faster, but it suffers linear dependency of the lower 4 bits. It is usually used for generating floating numbers using the upper 53 bits and discard the lower bits.
The Xoshiro256** algorithm is develped by David Blackman and Sebastiano Vigna (2018) and the source code can be found at: https://prng.di.unimi.it/xoshiro256starstar.c
Definition at line 49 of file xoshiro_256_star_star.h.
|
explicit |
Constructor. It initializes the state variable with random integers using splitmix64
pseudo-random generator.
Definition at line 33 of file xoshiro_256_star_star.cpp.
References SplitMix64::next(), and state.
Xoshiro256StarStar::~Xoshiro256StarStar | ( | ) |
void Xoshiro256StarStar::jump | ( | ) |
Jump function for the generator. It is equivalent to 2^128 calls to next()
; it can be used to generate 2^128 non-overlapping subsequences for parallel computations.
Definition at line 100 of file xoshiro_256_star_star.cpp.
References next(), state, and UINT64_C.
Referenced by RandomNumberGenerator::initialize().
void Xoshiro256StarStar::long_jump | ( | ) |
Long jump function for the generator. It is equivalent to 2^192 calls to next()
. It can be used to generate 2^64 starting points from each of which jump()
will generate 2^64 non-overlapping subsequences for parallel distributed computations.
Definition at line 145 of file xoshiro_256_star_star.cpp.
References next(), state, and UINT64_C.
uint64_t Xoshiro256StarStar::next | ( | ) |
Generates the next presudo-random number.
Definition at line 73 of file xoshiro_256_star_star.cpp.
References rotation_left(), and state.
Referenced by jump(), long_jump(), and RandomNumberGenerator::next().
|
inlinestaticprotected |
Rotates the bits of a 64 bit integer toward left.
[in] | x | A 64 bit integer to rotate its bits toward left. |
[in] | k | Number of bit places to rotate each bit of x |
k
bit moved left Definition at line 192 of file xoshiro_256_star_star.cpp.
Referenced by next().
|
protected |
Definition at line 64 of file xoshiro_256_star_star.h.
Referenced by jump(), long_jump(), next(), Xoshiro256StarStar(), and ~Xoshiro256StarStar().