#include <LCG.h>
Inheritance diagram for LCG::

Public Methods | |
| LCG (unsigned short seed=0) | |
| Constructor. More... | |
| void | reseed (unsigned seed) |
| Reseed the rng with a new seed value. | |
| unsigned short | 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 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 | |
| unsigned short | State [3] |
| The state for this rng. | |
| unsigned short | Seed |
| Use to initialize the generator. More... | |
This is a simple wrapper for the Unix nrand48 routine, and thus it is somewhat portable.
|
|
Constructor. If no argument is provided, the seed is set to zero, so the rng is initialized with the current time information. |
|
|
Use to initialize the generator. If zero, time is used to generate the random seed. |