library of assembled shared sources |
http://lass.cocamware.com |
RandomParkMiller is the LASS implementation of the Minimal Standard generator by Park and Miller. More...
#include <random.h>
Public Types | |
typedef num::Tuint32 | TValue |
type of return value. | |
Public Member Functions | |
RandomParkMiller () | |
default constructor. | |
RandomParkMiller (TValue seed) | |
default constructor. | |
void | seed (TValue seed) |
const TValue | operator() () |
draw a random number | |
const TValue | operator() (TValue supremum) |
draw a random number remapped to range [0, supremum) | |
template<typename OutputIterator > | |
OutputIterator | getState (OutputIterator first) const |
template<typename InputIterator > | |
void | setState (InputIterator first, InputIterator last) |
Static Public Attributes | |
static const TValue | max = RandomParkMiller::modulus_ |
maximum return value. | |
Private Types | |
enum | { multiplier_ = 16807, modulus_ = 2147483647, seedMask_ = 123456789, schrageQuotient_ = modulus_ / multiplier_, schrageRest_ = modulus_ % multiplier_ } |
Private Attributes | |
TValue | buffer_ |
RandomParkMiller is the LASS implementation of the Minimal Standard generator by Park and Miller.
Park and Miller, "Random Number Generators: Good ones are hard to find", Communications of the ACM, October 1988, Volume 31, No 10, pages 1192-1201.
Definition at line 96 of file random.h.
anonymous enum [private] |
lass::num::RandomParkMiller::RandomParkMiller | ( | ) |
default constructor.
will seed with default value
Definition at line 69 of file random.cpp.
References seed().
lass::num::RandomParkMiller::RandomParkMiller | ( | TValue | seed | ) | [explicit] |
default constructor.
will seed with default value
Definition at line 79 of file random.cpp.
References seed().
void lass::num::RandomParkMiller::seed | ( | TValue | seed | ) |
Definition at line 86 of file random.cpp.
References buffer_, and seedMask_.
Referenced by RandomParkMiller().
const RandomParkMiller::TValue lass::num::RandomParkMiller::operator() | ( | ) |
draw a random number
Definition at line 95 of file random.cpp.
References buffer_, multiplier_, schrageQuotient_, and schrageRest_.
const RandomParkMiller::TValue lass::num::RandomParkMiller::operator() | ( | TValue | supremum | ) | [inline] |
draw a random number remapped to range [0, supremum)
Definition at line 98 of file random.inl.
OutputIterator lass::num::RandomParkMiller::getState | ( | OutputIterator | first | ) | const [inline] |
void lass::num::RandomParkMiller::setState | ( | InputIterator | first, | |
InputIterator | last | |||
) | [inline] |
const RandomParkMiller::TValue lass::num::RandomParkMiller::max = RandomParkMiller::modulus_ [static] |
TValue lass::num::RandomParkMiller::buffer_ [private] |
Definition at line 125 of file random.h.
Referenced by getState(), operator()(), seed(), and setState().
Generated on Mon Nov 10 14:22:10 2008 for Library of Assembled Shared Sources by 1.5.7.1 |