Public Member Functions | Private Attributes | Static Private Attributes
vcg::math::MarsenneTwisterRNG Class Reference

#include <random_generator.h>

Inheritance diagram for vcg::math::MarsenneTwisterRNG:
Inheritance graph
[legend]

List of all members.

Public Member Functions

unsigned int generate (unsigned int limit)
 Return a random number in the given range (note that not all the RNG can handle a given limit).
unsigned int generate ()
double generate01 ()
 Returns a random number in the [0,1) real interval using the improved Marsenne-Twister.
double generate01closed ()
 Returns a random number in the [0,1] real interval using the improved Marsenne-Twister.
double generate01open ()
 Generates a random number in the (0,1) real interval using the improved Marsenne-Twister.
template<class PointType >
void generateBarycentric (PointType &p)
 Generate a random triple of baricentric coords.
void initialize (unsigned int seed)
 (Re-)initialize with the given seed.
void initializeByArray (unsigned int init_key[], int key_length)
 MarsenneTwisterRNG ()
 MarsenneTwisterRNG (unsigned int seed)
virtual ~MarsenneTwisterRNG ()

Private Attributes

unsigned int mt [N]
int mti

Static Private Attributes

static const unsigned int LOWER_MASK = 0x7fffffffu
static const int M = 397
static const unsigned int MATRIX_A = 0x9908b0dfu
static const int N = 624
static const unsigned int UPPER_MASK = 0x80000000u

Detailed Description

The second one is an improved Marsenne-Twister algorithm (MT19937) Coded by Takuji Nishimura and Makoto Matsumoto (see copyright note below) and successively modified to be a C++ class by Daniel Dunbar.

References for improved Marsenne-Twister:

http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html

Definition at line 250 of file random_generator.h.


Constructor & Destructor Documentation

Definition at line 273 of file random_generator.h.

vcg::math::MarsenneTwisterRNG::MarsenneTwisterRNG ( unsigned int  seed) [inline]

Definition at line 278 of file random_generator.h.

Definition at line 283 of file random_generator.h.


Member Function Documentation

unsigned int vcg::math::MarsenneTwisterRNG::generate ( unsigned int  limit) [inline, virtual]

Return a random number in the given range (note that not all the RNG can handle a given limit).

Implements vcg::math::RandomGenerator.

Definition at line 348 of file random_generator.h.

unsigned int vcg::math::MarsenneTwisterRNG::generate ( ) [inline]

Return a random number in the [0,0xffffffff] interval using the improved Marsenne Twister algorithm.

NOTE: Limit is not considered, the interval is fixed.

Definition at line 358 of file random_generator.h.

double vcg::math::MarsenneTwisterRNG::generate01 ( ) [inline, virtual]

Returns a random number in the [0,1) real interval using the improved Marsenne-Twister.

Implements vcg::math::RandomGenerator.

Definition at line 404 of file random_generator.h.

Returns a random number in the [0,1] real interval using the improved Marsenne-Twister.

Implements vcg::math::RandomGenerator.

Definition at line 398 of file random_generator.h.

double vcg::math::MarsenneTwisterRNG::generate01open ( ) [inline, virtual]

Generates a random number in the (0,1) real interval using the improved Marsenne-Twister.

Implements vcg::math::RandomGenerator.

Definition at line 410 of file random_generator.h.

template<class PointType >
void vcg::math::MarsenneTwisterRNG::generateBarycentric ( PointType p) [inline]

Generate a random triple of baricentric coords.

Definition at line 417 of file random_generator.h.

void vcg::math::MarsenneTwisterRNG::initialize ( unsigned int  seed) [inline, virtual]

(Re-)initialize with the given seed.

Implements vcg::math::RandomGenerator.

Definition at line 291 of file random_generator.h.

void vcg::math::MarsenneTwisterRNG::initializeByArray ( unsigned int  init_key[],
int  key_length 
) [inline]

Initialize by an array with array-length.

init_key is the array for initializing keys key_length is its length

Definition at line 312 of file random_generator.h.


Member Data Documentation

const unsigned int vcg::math::MarsenneTwisterRNG::LOWER_MASK = 0x7fffffffu [static, private]

Definition at line 260 of file random_generator.h.

const int vcg::math::MarsenneTwisterRNG::M = 397 [static, private]

Definition at line 257 of file random_generator.h.

const unsigned int vcg::math::MarsenneTwisterRNG::MATRIX_A = 0x9908b0dfu [static, private]

Definition at line 258 of file random_generator.h.

unsigned int vcg::math::MarsenneTwisterRNG::mt[N] [private]

Definition at line 266 of file random_generator.h.

Definition at line 267 of file random_generator.h.

const int vcg::math::MarsenneTwisterRNG::N = 624 [static, private]

Definition at line 256 of file random_generator.h.

const unsigned int vcg::math::MarsenneTwisterRNG::UPPER_MASK = 0x80000000u [static, private]

Definition at line 259 of file random_generator.h.


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


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:41:49