Visualization Library v1.0.3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends

vl::MersenneTwister Class Reference

#include <MersenneTwister.hpp>

Inheritance diagram for vl::MersenneTwister:
vl::Object

List of all members.

Public Types

enum  { N = 624 }
enum  { SAVE = N + 1 }
typedef unsigned long uint32

Public Member Functions

 MersenneTwister (const uint32 oneSeed)
 MersenneTwister (uint32 *const bigSeed, uint32 const seedLength=N)
 MersenneTwister ()
 MersenneTwister (const MersenneTwister &o)
uint32 randInt ()
uint32 randInt (const uint32 n)
double rand ()
double rand (const double n)
double randExc ()
double randExc (const double n)
double randDblExc ()
double randDblExc (const double n)
double operator() ()
double rand53 ()
double randNorm (const double mean=0.0, const double stddev=1.0)
void seed (const uint32 oneSeed)
void seed (uint32 *const bigSeed, const uint32 seedLength=N)
void seed ()
void save (uint32 *saveArray) const
void load (uint32 *const loadArray)
MersenneTwisteroperator= (const MersenneTwister &o)

Protected Types

enum  { M = 397 }

Protected Member Functions

void initialize (const uint32 oneSeed)
void reload ()
uint32 hiBit (const uint32 u) const
uint32 loBit (const uint32 u) const
uint32 loBits (const uint32 u) const
uint32 mixBits (const uint32 u, const uint32 v) const
uint32 magic (const uint32 u) const
uint32 twist (const uint32 m, const uint32 s0, const uint32 s1) const

Static Protected Member Functions

static uint32 hash (time_t t, clock_t c)

Protected Attributes

uint32 state [N]
uint32pNext
int left

Friends

std::ostream & operator<< (std::ostream &os, const MersenneTwister &mtrand)
std::istream & operator>> (std::istream &is, MersenneTwister &mtrand)

Detailed Description

Definition at line 86 of file MersenneTwister.hpp.


Member Typedef Documentation

typedef unsigned long vl::MersenneTwister::uint32

Definition at line 90 of file MersenneTwister.hpp.


Member Enumeration Documentation

anonymous enum
Enumerator:
N 

Definition at line 92 of file MersenneTwister.hpp.

anonymous enum
Enumerator:
SAVE 

Definition at line 93 of file MersenneTwister.hpp.

anonymous enum [protected]
Enumerator:
M 

Definition at line 96 of file MersenneTwister.hpp.


Constructor & Destructor Documentation

vl::MersenneTwister::MersenneTwister ( const uint32  oneSeed ) [inline]

Definition at line 282 of file MersenneTwister.hpp.

References seed().

vl::MersenneTwister::MersenneTwister ( uint32 *const   bigSeed,
uint32 const  seedLength = N 
) [inline]

Definition at line 285 of file MersenneTwister.hpp.

References seed().

vl::MersenneTwister::MersenneTwister (  ) [inline]

Definition at line 288 of file MersenneTwister.hpp.

References seed().

vl::MersenneTwister::MersenneTwister ( const MersenneTwister o ) [inline]

Definition at line 291 of file MersenneTwister.hpp.

References left, N, pNext, and state.


Member Function Documentation

MersenneTwister::uint32 vl::MersenneTwister::randInt (  ) [inline]
MersenneTwister::uint32 vl::MersenneTwister::randInt ( const uint32  n ) [inline]

Definition at line 317 of file MersenneTwister.hpp.

References randInt().

double vl::MersenneTwister::rand (  ) [inline]

Definition at line 336 of file MersenneTwister.hpp.

References randInt().

Referenced by operator()(), rand(), and randNorm().

double vl::MersenneTwister::rand ( const double  n ) [inline]

Definition at line 339 of file MersenneTwister.hpp.

References rand().

double vl::MersenneTwister::randExc (  ) [inline]

Definition at line 342 of file MersenneTwister.hpp.

References randInt().

Referenced by randExc().

double vl::MersenneTwister::randExc ( const double  n ) [inline]

Definition at line 345 of file MersenneTwister.hpp.

References randExc().

double vl::MersenneTwister::randDblExc (  ) [inline]

Definition at line 348 of file MersenneTwister.hpp.

References randInt().

Referenced by randDblExc().

double vl::MersenneTwister::randDblExc ( const double  n ) [inline]

Definition at line 351 of file MersenneTwister.hpp.

References randDblExc().

double vl::MersenneTwister::operator() (  ) [inline]

Definition at line 376 of file MersenneTwister.hpp.

References rand().

double vl::MersenneTwister::rand53 (  ) [inline]

Definition at line 354 of file MersenneTwister.hpp.

References randInt().

Referenced by vl::random().

double vl::MersenneTwister::randNorm ( const double  mean = 0.0,
const double  stddev = 1.0 
) [inline]

Definition at line 360 of file MersenneTwister.hpp.

References vl::log(), rand(), and vl::sqrt().

void vl::MersenneTwister::seed ( const uint32  oneSeed ) [inline]

Definition at line 217 of file MersenneTwister.hpp.

References initialize(), and reload().

void vl::MersenneTwister::seed ( uint32 *const   bigSeed,
const uint32  seedLength = N 
) [inline]

Definition at line 224 of file MersenneTwister.hpp.

References initialize(), N, reload(), and state.

void vl::MersenneTwister::seed (  ) [inline]

Definition at line 259 of file MersenneTwister.hpp.

References hash(), N, and NULL.

Referenced by MersenneTwister().

void vl::MersenneTwister::save ( uint32 saveArray ) const [inline]

Definition at line 381 of file MersenneTwister.hpp.

References left, N, and state.

void vl::MersenneTwister::load ( uint32 *const   loadArray ) [inline]

Definition at line 390 of file MersenneTwister.hpp.

References left, N, pNext, and state.

MersenneTwister & vl::MersenneTwister::operator= ( const MersenneTwister o ) [inline]

Definition at line 418 of file MersenneTwister.hpp.

References left, N, pNext, and state.

void vl::MersenneTwister::initialize ( const uint32  oneSeed ) [inline, protected]

Definition at line 184 of file MersenneTwister.hpp.

References N, and state.

Referenced by seed().

void vl::MersenneTwister::reload (  ) [inline, protected]

Definition at line 201 of file MersenneTwister.hpp.

References left, M, N, pNext, state, and twist().

Referenced by randInt(), and seed().

uint32 vl::MersenneTwister::hiBit ( const uint32  u ) const [inline, protected]

Definition at line 145 of file MersenneTwister.hpp.

Referenced by mixBits().

uint32 vl::MersenneTwister::loBit ( const uint32  u ) const [inline, protected]

Definition at line 146 of file MersenneTwister.hpp.

Referenced by magic().

uint32 vl::MersenneTwister::loBits ( const uint32  u ) const [inline, protected]

Definition at line 147 of file MersenneTwister.hpp.

Referenced by mixBits().

uint32 vl::MersenneTwister::mixBits ( const uint32  u,
const uint32  v 
) const [inline, protected]

Definition at line 148 of file MersenneTwister.hpp.

References hiBit(), and loBits().

Referenced by twist().

uint32 vl::MersenneTwister::magic ( const uint32  u ) const [inline, protected]

Definition at line 150 of file MersenneTwister.hpp.

References loBit().

Referenced by twist().

uint32 vl::MersenneTwister::twist ( const uint32  m,
const uint32  s0,
const uint32  s1 
) const [inline, protected]

Definition at line 152 of file MersenneTwister.hpp.

References magic(), and mixBits().

Referenced by reload().

MersenneTwister::uint32 vl::MersenneTwister::hash ( time_t  t,
clock_t  c 
) [inline, static, protected]

Definition at line 159 of file MersenneTwister.hpp.

Referenced by seed().


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const MersenneTwister mtrand 
) [friend]

Definition at line 400 of file MersenneTwister.hpp.

std::istream& operator>> ( std::istream &  is,
MersenneTwister mtrand 
) [friend]

Definition at line 408 of file MersenneTwister.hpp.


Member Data Documentation

Definition at line 99 of file MersenneTwister.hpp.

Referenced by load(), MersenneTwister(), operator=(), vl::operator>>(), randInt(), and reload().

int vl::MersenneTwister::left [protected]

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

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:06.
Permission is granted to use this page to write and publish articles regarding Visualization Library.