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

Updated Mersenne twister. More...

#include <mersenne_twister.h>

Inheritance diagram for RNG::mersenne_twister:
Inheritance graph
Collaboration diagram for RNG::mersenne_twister:
Collaboration graph

Public Member Functions

virtual std::string to_string () const
 
virtual ~mersenne_twister ()
 Cleanup. More...
 
virtual rngint_t value ()
 Get a value in the interval [0,numeric_limits<rngint_t>::max()]. More...
 
virtual void vec_reseed (const std::vector< rngint_t > &seeds)
 Reseed the generator. This is an expensive operation. More...
 
virtual int nseed ()
 The number of seeds employed by this generator. More...
 
- 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 mersenne_twisterconstruct (uint64_t seed)
 Create a new twister. More...
 

Private Member Functions

void reseed (uint64_t seed)
 
 mersenne_twister (uint64_t seed)
 Like normally for SST/macro types, constructor is private. More...
 

Private Attributes

std::vector< uint64_t > mt_
 The array for the state vector. Of length 'state_vector_length_'. More...
 
size_t mti_
 The current position in the state vector ('mti' in original code). More...
 

Static Private Attributes

static const int state_vector_length_
 State vector length defaults to 312 entries ('NN' in original code). More...
 
static const int mask_length_
 I believe this is a mask length, defaults to 156 ('MM' in original). More...
 

Detailed Description

Updated Mersenne twister.

Copyright (C) 2004, Makoto Matsumoto and Takuji Nishimura, All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission.

Modified to fit into the SST/macroscale code structure and to eliminate global (static) state.

Definition at line 106 of file mersenne_twister.h.

Constructor & Destructor Documentation

RNG::mersenne_twister::mersenne_twister ( uint64_t  seed)
private

Like normally for SST/macro types, constructor is private.

virtual RNG::mersenne_twister::~mersenne_twister ( )
virtual

Cleanup.

Referenced by to_string().

Member Function Documentation

static mersenne_twister* RNG::mersenne_twister::construct ( uint64_t  seed)
static

Create a new twister.

Referenced by to_string().

virtual int RNG::mersenne_twister::nseed ( )
inlinevirtual

The number of seeds employed by this generator.

The generator will accept any value up to state_vector_length_.

Implements RNG::UniformInteger.

Definition at line 142 of file mersenne_twister.h.

References state_vector_length_.

void RNG::mersenne_twister::reseed ( uint64_t  seed)
private
virtual std::string RNG::mersenne_twister::to_string ( ) const
inlinevirtual

Definition at line 124 of file mersenne_twister.h.

References construct(), value(), vec_reseed(), and ~mersenne_twister().

Here is the call graph for this function:

virtual rngint_t RNG::mersenne_twister::value ( )
virtual

Get a value in the interval [0,numeric_limits<rngint_t>::max()].

Implements RNG::UniformInteger.

Referenced by to_string().

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

Reseed the generator. This is an expensive operation.

Implements RNG::UniformInteger.

Referenced by to_string().

Member Data Documentation

const int RNG::mersenne_twister::mask_length_
staticprivate

I believe this is a mask length, defaults to 156 ('MM' in original).

Definition at line 111 of file mersenne_twister.h.

std::vector<uint64_t> RNG::mersenne_twister::mt_
private

The array for the state vector. Of length 'state_vector_length_'.

Definition at line 113 of file mersenne_twister.h.

size_t RNG::mersenne_twister::mti_
private

The current position in the state vector ('mti' in original code).

Definition at line 115 of file mersenne_twister.h.

const int RNG::mersenne_twister::state_vector_length_
staticprivate

State vector length defaults to 312 entries ('NN' in original code).

Definition at line 109 of file mersenne_twister.h.

Referenced by nseed().


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