NEST  2.6.0,not_revisioned_source_dir@0
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
librandom::MT19937 Class Reference

Mersenne Twister MT19937. More...

#include <mt19937.h>

Inheritance diagram for librandom::MT19937:
librandom::RandomGen

Public Member Functions

 MT19937 (unsigned long)
 Create generator with given seed. More...
 
 ~MT19937 ()
 
RngPtr clone (unsigned long s)
 clone a random number generator of same type initialized with given seed More...
 
- Public Member Functions inherited from librandom::RandomGen
 RandomGen ()
 
virtual ~RandomGen ()
 
double drand (void)
 The following functions implement the user interface of the RandomGen class, including buffer management. More...
 
double operator() (void)
 draw from [0, 1) More...
 
double drandpos (void)
 draw from (0, 1) More...
 
unsigned long ulrand (const unsigned long)
 draw from [0, n-1] More...
 
void seed (const unsigned long)
 set random seed to a new value More...
 
size_t get_buffsize (void) const
 returns buffer size More...
 
void set_buffsize (const size_t)
 set buffer size More...
 

Private Member Functions

void seed_ (unsigned long)
 implements seeding for RandomGen More...
 
double drand_ ()
 implements drawing a single [0,1) number for RandomGen More...
 
void init_genrand (unsigned long)
 
unsigned long genrand_int32 ()
 
double genrand_real2 ()
 

Private Attributes

std::vector< unsigned long > mt
 
int mti
 

Static Private Attributes

static const unsigned int N = 624
 
static const unsigned int M = 397
 
static const unsigned long MATRIX_A = 0x9908b0dfUL
 
static const unsigned long UPPER_MASK = 0x80000000UL
 
static const unsigned long LOWER_MASK = 0x7fffffffUL
 
static const double I2DFactor_ = 1.0/4294967296.0
 int to double factor More...
 

Additional Inherited Members

- Static Public Member Functions inherited from librandom::RandomGen
static RngPtr create_knuthlfg_rng (unsigned long)
 Create built-in Knuth Lagged Fibonacci random generator. More...
 
- Static Public Attributes inherited from librandom::RandomGen
static const unsigned long DefaultSeed = 0xd37ca59fUL
 Default value for seeding generators in places where no seed is supplied. More...
 

Detailed Description

Mersenne Twister MT19937.

This class implements the 32-bit MT19937 Mersenne Twister RNG by Matsumoto and Nishimura. The implementation wraps a C++ class around the originial code.

Constructor & Destructor Documentation

librandom::MT19937::MT19937 ( unsigned long  s)
explicit

Create generator with given seed.

References init_genrand().

Referenced by clone().

librandom::MT19937::~MT19937 ( )
inline

Member Function Documentation

RngPtr librandom::MT19937::clone ( unsigned long  long)
inlinevirtual

clone a random number generator of same type initialized with given seed

Implements librandom::RandomGen.

References MT19937().

double librandom::MT19937::drand_ ( void  )
inlineprivatevirtual

implements drawing a single [0,1) number for RandomGen

Implements librandom::RandomGen.

References genrand_real2().

unsigned long librandom::MT19937::genrand_int32 ( )
private

References nest::names::N, and nest::names::y.

double librandom::MT19937::genrand_real2 ( )
inlineprivate

Referenced by drand_().

void librandom::MT19937::init_genrand ( unsigned long  s)
private

References nest::names::N.

Referenced by MT19937().

void librandom::MT19937::seed_ ( unsigned long  s)
privatevirtual

implements seeding for RandomGen

Implements librandom::RandomGen.

Member Data Documentation

const double librandom::MT19937::I2DFactor_ = 1.0/4294967296.0
staticprivate

int to double factor

const unsigned long librandom::MT19937::LOWER_MASK = 0x7fffffffUL
staticprivate
const unsigned int librandom::MT19937::M = 397
staticprivate
const unsigned long librandom::MT19937::MATRIX_A = 0x9908b0dfUL
staticprivate
std::vector<unsigned long> librandom::MT19937::mt
private
int librandom::MT19937::mti
private
const unsigned int librandom::MT19937::N = 624
staticprivate
const unsigned long librandom::MT19937::UPPER_MASK = 0x80000000UL
staticprivate

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