Implements a lightweight RNG based on XOR-shift operations. More...
#include "sst/core/rng/xorshift.h"
Public Member Functions | |
XORShiftRNG (unsigned int seed) | |
Create a new Mersenne RNG with a specified seed. | |
XORShiftRNG () | |
Creates a new Mersenne using a random seed which is obtained from the system clock. | |
double | nextUniform () |
Generates the next random number as a double value between 0 and 1. | |
uint32_t | generateNextUInt32 () |
Generates the next random number as an unsigned 32-bit integer. | |
uint64_t | generateNextUInt64 () |
Generates the next random number as an unsigned 64-bit integer. | |
int64_t | generateNextInt64 () |
Generates the next random number as a signed 64-bit integer. | |
int32_t | generateNextInt32 () |
Generates the next random number as a signed 32-bit integer. | |
~XORShiftRNG () | |
Destructor for Mersenne. | |
Protected Attributes | |
uint32_t | x |
uint32_t | y |
uint32_t | z |
uint32_t | w |
Implements a lightweight RNG based on XOR-shift operations.
We utilize the XORSHIFT algorithm from: http://en.wikipedia.org/wiki/Xorshift. This is a very lightweight and inexpensive RNG.
XORShiftRNG::XORShiftRNG | ( | unsigned int | seed | ) |
Create a new Mersenne RNG with a specified seed.
[in] | seed | The seed for this RNG |
XORShiftRNG::XORShiftRNG | ( | ) |
Creates a new Mersenne using a random seed which is obtained from the system clock.
Note this will give different results on different platforms and between runs.