SST::RNG::MarsagliaRNG Class Reference

Implements a random number generator using the Marsaglia method. More...

#include "sst/core/rng/marsaglia.h"

Inheritance diagram for SST::RNG::MarsagliaRNG:
SST::RNG::SSTRandom

Public Member Functions

 MarsagliaRNG (unsigned int initial_z, unsigned int initial_w)
 Creates a new Marsaglia RNG using the initial seeds.
 MarsagliaRNG ()
 Creates a new Marsaglia RNG using random initial seeds (which are read from the system clock).
void restart (unsigned int new_z, unsigned int new_w)
 Restart the random number generator with new seeds.
double nextUniform ()
 Generates the next random number as a double in the range 0 to 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 number as a signed 64-bit integer.
int32_t generateNextInt32 ()
 Generates the next number as a signed 32-bit integer.

Detailed Description

Implements a random number generator using the Marsaglia method.

This method is computationally cheap and provides a reasonable distribution of random numbers. If you need additional strength in the random numbers you may want to consider the Mersenne RNG.

For more information see the Multiply-with-carry Random Number Generator article at Wikipedia (http://en.wikipedia.org/wiki/Multiply-with-carry).


Constructor & Destructor Documentation

MarsagliaRNG::MarsagliaRNG ( unsigned int  initial_z,
unsigned int  initial_w 
)

Creates a new Marsaglia RNG using the initial seeds.

Parameters:
[in] initial_z One of the random seed pairs
[in] initial_w One of the random seed pairs.
MarsagliaRNG::MarsagliaRNG (  ) 

Creates a new Marsaglia RNG using random initial seeds (which are read from the system clock).

Note that these will create variation between runs and between platforms.


Member Function Documentation

void MarsagliaRNG::restart ( unsigned int  new_z,
unsigned int  new_w 
)

Restart the random number generator with new seeds.

Parameters:
[in] new_z A new Z-seed
[in] new_w A new W-seed

The documentation for this class was generated from the following files:

Generated on 14 Sep 2015 for SST by  doxygen 1.6.1