library of assembled shared sources

http://lass.cocamware.com

lass::num::RandomParkMiller Class Reference
[Random]

Minimal Standard generator by Park and Miller

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_


Detailed Description

Minimal Standard generator by Park and Miller

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.


Member Typedef Documentation

type of return value.

Definition at line 100 of file random.h.


Member Enumeration Documentation

anonymous enum [private]

Enumerator:
multiplier_ 
modulus_ 
seedMask_ 
schrageQuotient_ 
schrageRest_ 

Definition at line 116 of file random.h.


Constructor & Destructor Documentation

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().


Member Function Documentation

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)

Deprecated:
this is A VERY BAD WAY TO DO IT!

Definition at line 98 of file random.inl.

template<typename OutputIterator >
OutputIterator lass::num::RandomParkMiller::getState ( OutputIterator  first  )  const [inline]

Definition at line 106 of file random.inl.

References buffer_.

template<typename InputIterator >
void lass::num::RandomParkMiller::setState ( InputIterator  first,
InputIterator  last 
) [inline]

Definition at line 115 of file random.inl.

References buffer_, and LASS_ASSERT.


Field Documentation

const RandomParkMiller::TValue lass::num::RandomParkMiller::max = RandomParkMiller::modulus_ [static]

maximum return value.

Definition at line 101 of file random.h.

Definition at line 125 of file random.h.

Referenced by getState(), operator()(), seed(), and setState().


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

Generated on Mon Nov 10 14:22:10 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo