Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Math Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWRandGenMTwist

Module:  Essential Math   Group:  Statistics classes


Does not inherit

Local Index

Members

Non-Members

Synopsis

#include <rw/randmtwist.h>
RWRandGenMTwist gen;

Description

Class RWRandGenMTwist generates random numbers uniformly distributed over the interval [0, 1], and may be used instead of class RWRandGenerator as a template parameter to any of the distribution generators derived from abstract base class RWTRand<>. RWRandGenMTwist uses Takuji Nishimura and Makoto Matsumoto's Mersenne Twister algorithm. It is relatively fast, and has a large period (2^19937-1).

Unlike class RWRandGenerator, each instance of RWRandGenMTwist contains and maintains its own, independent state. This can make it easier to use in some situations. The "internal state" of an instance of RWRandGenMTwist consists of a table of an unsigned long seed, an array of unsigned longs known as the "state vector" and an integer index into that state vector.

Additional information about the Mersenne Twister Algorithm is available in the following sources:

  1. The original Arcticle
    M. Matsumoto and T. Nishimura,
    "Mersenne Twister: A 623-dimensionally equidistributed uniform
    pseudorandom number generator",
    ACM Trans. on Modeling and Computer Simulation
    Vol. 8, No. 1, Januray pp.3-30 1998

  2. The Mersenne Twister Website
    http://www.math.keio.ac.jp/~matumoto/emt.html

Public Constructors

RWRandGenMTwist();
RWRandGenMTwist(const RWRandGenMTwist& x);
RWRandGenMTwist(unsigned long seed);

Public Member Functions

unsigned 
long seed() const;
void 
restart();
void 
restart(unsigned long seed);

Public Member Operators

double 
operator()();
void 
operator=(const RWRandGenMTwist& x);
bool 
operator==(const RWRandGenMTwist& x) const;
bool 
operator!=(const RWRandGenMTwist& x) const;
void
printOn(std::ostream& s) const; 
void
scanFrom(std::istream& s);
void
restoreFrom(RWvistream&);
void
restoreFrom(RWFile&);
void
saveOn(RWvostream&) const;
void
saveOn(RWFile&) const;

Related Global Operator

std::ostream& rwmathexport
operator<< (std::ostream& s, const RWRandGenMTwist& rgen);
std::istream& rwmathexport
operator>> (std::istream& s, RWRandGenMTwist& rgen);


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.