SST
14.1.0
StructuralSimulationToolkit
|
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 Xorshift RNG with a specified seed. More... | |
XORShiftRNG () | |
Creates a new Xorshift using a random seed which is obtained from the system clock. More... | |
double | nextUniform () override |
Generates the next random number as a double value between 0 and 1. | |
uint32_t | generateNextUInt32 () override |
Generates the next random number as an unsigned 32-bit integer. | |
uint64_t | generateNextUInt64 () override |
Generates the next random number as an unsigned 64-bit integer. | |
int64_t | generateNextInt64 () override |
Generates the next random number as a signed 64-bit integer. | |
int32_t | generateNextInt32 () override |
Generates the next random number as a signed 32-bit integer. | |
void | seed (uint64_t newSeed) |
Seed the XOR RNG. | |
~XORShiftRNG () | |
Destructor for Xorshift. | |
void | serialize_order (SST::Core::Serialization::serializer &ser) override |
Serialization function for checkpoint. | |
Public Member Functions inherited from SST::RNG::Random | |
virtual | ~Random () |
Destroys the random number generator. | |
virtual void | serialize_order (SST::Core::Serialization::serializer &UNUSED(ser)) override |
Public Member Functions inherited from SST::Core::Serialization::serializable_base | |
virtual const char * | cls_name () const =0 |
virtual uint32_t | cls_id () const =0 |
virtual std::string | serialization_name () const =0 |
Data Fields | |
ImplementSerializable(SST::RNG::XORShiftRNG) protected uint32_t | y |
Serialization macro. | |
uint32_t | z |
uint32_t | w |
Additional Inherited Members | |
Static Public Attributes inherited from SST::Core::Serialization::serializable | |
static constexpr uint32_t | NullClsId = std::numeric_limits<uint32_t>::max() |
Static Public Attributes inherited from SST::Core::Serialization::serializable_base | |
static constexpr uint32_t | NullClsId = std::numeric_limits<uint32_t>::max() |
Protected Types inherited from SST::Core::Serialization::serializable_base | |
enum | cxn_flag_t { ConstructorFlag } |
Static Protected Member Functions inherited from SST::Core::Serialization::serializable_base | |
static void | serializable_abort (uint32_t line, const char *file, const char *func, const char *obj) |
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 Xorshift RNG with a specified seed.
[in] | seed | The seed for this RNG |
References seed().
XORShiftRNG::XORShiftRNG | ( | ) |
Creates a new Xorshift using a random seed which is obtained from the system clock.
Note this will give different results on different platforms and between runs.
References y.