bpp-core3
3.0.0
|
A uniform random number generator. More...
#include <Bpp/Numeric/Random/Uniform01K.h>
Public Member Functions | |
Uniform01K (long seed) | |
Create a Random Number Generator. More... | |
virtual | ~Uniform01K () |
Destroy the generator. More... | |
void | setSeed (long seed) |
Set the seed for a new set of random numbers. More... | |
double | drawNumber () const |
Get a random number between 0.0 and 1.0 (exclusive of the end point values). More... | |
Private Attributes | |
long | _tab [56] |
unsigned int | _it1 |
unsigned int | _it2 |
Static Private Attributes | |
static const long | MAXNUMBER = 1000000000 |
static const long | ZERO = 0 |
static const long | MODSEED = 256434901 |
A uniform random number generator.
This is a uniform generator which draw double between 0 and 1 excluding the end points. This generator is based on an algorithm described by D.E. Knuth, 1981, "Seminumerical Algorithms" 2nd ed., vol.2 of "The Art of Computer Programming" (Reading, MA: Addison-Wesley), ยงยง3.2-3.3.
The algorithm used here is the one described in "Numerical Recipes in C".
Definition at line 60 of file Uniform01K.h.
Uniform01K::Uniform01K | ( | long | seed | ) |
Create a Random Number Generator.
seed | The seed for the random numbers. |
Definition at line 53 of file Uniform01K.cpp.
References setSeed().
|
virtual |
Destroy the generator.
Definition at line 60 of file Uniform01K.cpp.
|
virtual |
Get a random number between 0.0 and 1.0 (exclusive of the end point values).
Implements bpp::RandomFactory.
Definition at line 98 of file Uniform01K.cpp.
|
virtual |
Set the seed for a new set of random numbers.
Implements bpp::RandomFactory.
Definition at line 64 of file Uniform01K.cpp.
References _it1, _it2, _tab, bpp::NumTools::abs(), MAXNUMBER, MODSEED, and ZERO.
Referenced by Uniform01K().
|
mutableprivate |
Definition at line 92 of file Uniform01K.h.
Referenced by drawNumber(), and setSeed().
|
mutableprivate |
Definition at line 93 of file Uniform01K.h.
Referenced by drawNumber(), and setSeed().
|
mutableprivate |
Definition at line 91 of file Uniform01K.h.
Referenced by drawNumber(), and setSeed().
|
staticprivate |
Definition at line 88 of file Uniform01K.h.
Referenced by drawNumber(), and setSeed().
|
staticprivate |
Definition at line 90 of file Uniform01K.h.
Referenced by setSeed().
|
staticprivate |
Definition at line 89 of file Uniform01K.h.
Referenced by drawNumber(), and setSeed().