SST/macro
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
RNG::MWC Class Reference

The multiple-with-carry random number generator by George Marsaglia (1999; internet posting). More...

#include <rng.h>

Inheritance diagram for RNG::MWC:
Inheritance graph
Collaboration diagram for RNG::MWC:
Collaboration graph

Public Member Functions

virtual std::string to_string () const
 
 ~MWC ()
 
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 MWCconstruct ()
 
static MWCconstruct (const std::vector< rngint_t > &)
 
static MWCconstruct (rngint_t zarg)
 
static MWCconstruct (rngint_t zarg, rngint_t warg)
 

Protected Member Functions

 MWC ()
 

Private Member Functions

rngint_t znew ()
 
rngint_t wnew ()
 

Private Attributes

rngint_t z
 
rngint_t w
 

Static Private Attributes

static const rngint_t default_z
 
static const rngint_t default_w
 

Detailed Description

The multiple-with-carry random number generator by George Marsaglia (1999; internet posting).

This RNG is fast and has a low memory footprint. Here is an excerpt from the posting describing this generator: The MWC generator concatenates two 16-bit multiply-with-carry generators, x(n)=36969x(n-1)+carry, y(n)=18000y(n-1)+carry mod 216, has period about 260 and seems to pass all tests of randomness. A favorite stand-alone generator—faster than KISS, which contains it.

Definition at line 95 of file rng.h.

Constructor & Destructor Documentation

RNG::MWC::MWC ( )
protected
RNG::MWC::~MWC ( )

Member Function Documentation

static MWC* RNG::MWC::construct ( )
static
static MWC* RNG::MWC::construct ( const std::vector< rngint_t > &  )
static
static MWC* RNG::MWC::construct ( rngint_t  zarg)
static
static MWC* RNG::MWC::construct ( rngint_t  zarg,
rngint_t  warg 
)
static
int RNG::MWC::nseed ( )
virtual

Implements RNG::UniformInteger.

virtual std::string RNG::MWC::to_string ( ) const
inlinevirtual

Definition at line 116 of file rng.h.

rngint_t RNG::MWC::value ( )
inlinevirtual

Implements RNG::UniformInteger.

Definition at line 135 of file rng.h.

References RNG::UniformInteger::nseed(), and RNG::UniformInteger::vec_reseed().

Here is the call graph for this function:

void RNG::MWC::vec_reseed ( const std::vector< rngint_t > &  seeds)
virtual

Implements RNG::UniformInteger.

rngint_t RNG::MWC::wnew ( )
inlineprivate

Definition at line 107 of file rng.h.

rngint_t RNG::MWC::znew ( )
inlineprivate

Definition at line 102 of file rng.h.

Member Data Documentation

const rngint_t RNG::MWC::default_w
staticprivate

Definition at line 98 of file rng.h.

const rngint_t RNG::MWC::default_z
staticprivate

Definition at line 98 of file rng.h.

rngint_t RNG::MWC::w
private

Definition at line 99 of file rng.h.

rngint_t RNG::MWC::z
private

Definition at line 99 of file rng.h.


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