SST/macro
|
The 3-shift-register random number generator by George Marsaglia (1999; internet posting). More...
#include <rng.h>
Public Member Functions | |
virtual std::string | to_string () const |
~SHR3 () | |
rngint_t | value () |
void | vec_reseed (const std::vector< rngint_t > &seeds) |
int | nseed () |
Public Member Functions inherited from RNG::UniformInteger | |
virtual | ~UniformInteger () |
rngint_t | value_in_range (rngint_t range) |
virtual double | realvalue (bool include_zero=true, bool include_one=true) |
Return a random value in the interval [0,1], (0,1], [0,1), or (0,1) More... | |
void | reseed () |
void | reseed (rngint_t) |
void | reseed (rngint_t, rngint_t) |
void | reseed (rngint_t, rngint_t, rngint_t) |
void | reseed (rngint_t, rngint_t, rngint_t, rngint_t) |
Static Public Member Functions | |
static SHR3 * | construct () |
static SHR3 * | construct (const std::vector< rngint_t > &) |
static SHR3 * | construct (rngint_t jsrarg) |
Protected Member Functions | |
SHR3 () | |
Private Attributes | |
rngint_t | jsr |
The 3-shift-register random number generator by George Marsaglia (1999; internet posting).
This RNG is fast and has a very low memory footprint. Here is an excerpt from the posting describing this generator: SHR3 is a 3-shift-register generator with period 232-1. It uses y(n)=y(n-1)(I+L17)(I+R13)(I+L5), with the y's viewed as binary vectors, L the 32x32 binary matrix that shifts a vector left 1, and R its transpose. SHR3 seems to pass all except the binary rank test, since 32 successive values, as binary vectors, must be linearly independent, while 32 successive truly random 32-bit integers, viewed as binary vectors, will be linearly independent only about 29% of the time.
|
protected |
RNG::SHR3::~SHR3 | ( | ) |
|
static |
Referenced by RNG::ExponentialDistribution::ExponentialDistribution().
|
virtual |
Implements RNG::UniformInteger.
|
inlinevirtual |
Definition at line 170 of file rng.h.
References RNG::UniformInteger::nseed(), RNG::UniformInteger::value(), and RNG::UniformInteger::vec_reseed().
|
virtual |
Implements RNG::UniformInteger.
|
virtual |
Implements RNG::UniformInteger.