libcoyotl - A Library of C++ Tools
Created by Scott Robert Ladd at
Coyote Gulch Productions.
libcoyotl::mwc256 Class Reference
Implements MWC256, a peudorandom number generator.
More...
#include <mwc256.h>
Inheritance diagram for libcoyotl::mwc256:
List of all members.Public Member Functions
- mwc256 ()
- Default constructor, reading seed from/dev/urandom or the time.
- mwc256 (uint32_t seed)
- Default constructor, with optional seed.
- virtual void init (uint32_t seed)
- Initializes the generator with "seed".
- virtual uint32_t get_rand ()
- Get the next integer.
Detailed Description
A multiply with carry psudeorandom number generator, as suggested by George Marsaglia.
Constructor & Destructor Documentation
libcoyotl::mwc256::mwc256 |
( |
|
) |
|
|
|
The constructor initializes the prng seed from either the time or some stochastic source such as /dev/random or /dev/urandom. |
libcoyotl::mwc256::mwc256 |
( |
uint32_t |
seed |
) |
|
|
|
The constructor uses an explicit value for the seed. - Parameters:
-
| seed | - Seed value used to "start" or seed the generator |
|
Member Function Documentation
virtual uint32_t libcoyotl::mwc256::get_rand |
( |
|
) |
[virtual] |
|
|
Returns the next uint32_t in sequence. - Returns:
- A pseudorandom uint32_t value
Implements libcoyotl::prng. |
virtual void libcoyotl::mwc256::init |
( |
uint32_t |
seed |
) |
[virtual] |
|
|
Resets the generator using the provided seed value. - Parameters:
-
| seed | - Seed value used to "start" or seed the generator |
Reimplemented from libcoyotl::prng. |
The documentation for this class was generated from the following file:
© 1996-2005 Scott Robert Ladd. All rights reserved.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.