PM_LCG Class Reference

A portable linear congruential generator based on the rng developed by Park and Miller. More...

#include <PM_LCG.h>

Inheritance diagram for PM_LCG::

RNG List of all members.

Public Methods

 PM_LCG (int seed=0)
 Constructor. More...

void reseed (int seed)
 Reseed the rng with a new seed value.

int getSeed ()
 Returns the seed used to initialize the rng.

virtual void reset ()
 Reset the number generator to prepare it for use.

virtual unsigned long asLong ()
 Return a long in 0 ... LONG_MAX.

virtual double asDouble ()
 Return double in [0,1[.

virtual int write (std::ostream &output) const
 Write the rng state to an output stream.

virtual int read (std::istream &input)
 Read an rng state from an input stream.


Private Attributes

int state
 The state for this rng.

int jseed
 Use to initialize the generator. More...


Detailed Description

A portable linear congruential generator based on the rng developed by Park and Miller.

This rng is implemented in PMrand function.


Constructor & Destructor Documentation

PM_LCG::PM_LCG int    seed = 0 [inline]
 

Constructor.

If no argument is provided, the seed is set to zero, so the rng * is initialized with the current time information.


Member Data Documentation

int PM_LCG::jseed [private]
 

Use to initialize the generator.

If zero, time is used to generate the random seed.


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