vcg::math::SubtractiveRingRNG Class Reference

#include <random_generator.h>

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

List of all members.

Public Member Functions

unsigned int generate (unsigned int limit=0xffffffffu)
 Return a random number in the given range (limit) using the Subtractive Ring method.
double generate01 ()
 Return a random number in the [0,1) real interval using the Subtractive Ring method.
double generate01closed ()
 Returns a random number in the [0,1] real interval using the Subtractive Ring method.
double generate01open ()
 Generates a random number in the (0,1) real interval using the Subtractive Ring method.
void initialize (unsigned int seed)
 (Re-)initialize with a given seed.
 SubtractiveRingRNG (int default_seed=161803398u)
virtual ~SubtractiveRingRNG ()

Private Attributes

size_t _M_index1
size_t _M_index2
unsigned int _M_table [55]

Detailed Description

Uniform RNG derived from a STL extension of sgi.

It is based on the Subtractive Ring method. This implementation assumes that int is 32 bits.

References

D. E. Knuth, The Art of Computer Programming. Volume 2: Seminumerical Algorithms, 2nd Edition. Addison-Wesley, 1981. (section 3.6 of Knuth for an implementation of the subtractive method in FORTRAN) (section 3.2.2 of Knuth analyzes this class of algorithms)

Definition at line 79 of file random_generator.h.


Constructor & Destructor Documentation

vcg::math::SubtractiveRingRNG::SubtractiveRingRNG ( int  default_seed = 161803398u  )  [inline]

Definition at line 94 of file random_generator.h.

virtual vcg::math::SubtractiveRingRNG::~SubtractiveRingRNG (  )  [inline, virtual]

Definition at line 99 of file random_generator.h.


Member Function Documentation

unsigned int vcg::math::SubtractiveRingRNG::generate ( unsigned int  limit = 0xffffffffu  )  [inline, virtual]

Return a random number in the given range (limit) using the Subtractive Ring method.

Implements vcg::math::RandomGenerator.

Definition at line 128 of file random_generator.h.

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

Return a random number in the [0,1) real interval using the Subtractive Ring method.

Implements vcg::math::RandomGenerator.

Definition at line 137 of file random_generator.h.

double vcg::math::SubtractiveRingRNG::generate01closed (  )  [inline, virtual]

Returns a random number in the [0,1] real interval using the Subtractive Ring method.

Implements vcg::math::RandomGenerator.

Definition at line 145 of file random_generator.h.

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

Generates a random number in the (0,1) real interval using the Subtractive Ring method.

Implements vcg::math::RandomGenerator.

Definition at line 153 of file random_generator.h.

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

(Re-)initialize with a given seed.

Implements vcg::math::RandomGenerator.

Definition at line 106 of file random_generator.h.


Member Data Documentation

Definition at line 87 of file random_generator.h.

Definition at line 88 of file random_generator.h.

unsigned int vcg::math::SubtractiveRingRNG::_M_table[55] [private]

Definition at line 86 of file random_generator.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


vcglib
Author(s): Christian Bersch
autogenerated on Fri Jan 11 09:23:25 2013