Private to objects (a la meshes) who need their own source of random variables. More...
#include <random.H>
Public Member Functions | |
Constructors | |
RandomGen () | |
Default constructor. Creates a random number generator with a default seed (1). | |
RandomGen (long i) | |
Constructor that creates a random number generator with the seed given in the argument. | |
Seed Accessor Functions | |
void | srand (long i=1) |
Seeds the random number generator with the seed i . | |
long | get_seed () |
Gets the current seed value. | |
Random Number Generation Functions | |
long | lrand () |
Generate a random long integer. | |
double | drand () |
Generate a random double precision floating point value in the range [0.0, 1.0]. | |
Static Public Attributes | |
static long | R_MAX = RAND_MAX |
The maximum integer value that can be produced by this random number generator. | |
Private Member Functions | |
void | update () |
Generate the next seed (i.e. the next random value). | |
Private Attributes | |
long | _seed |
The current seed value. |
Private to objects (a la meshes) who need their own source of random variables.
Definition at line 21 of file random.H.
|
Default constructor. Creates a random number generator with a default seed (1).
Definition at line 31 of file random.H. References srand(). |
|
Constructor that creates a random number generator with the seed given in the argument.
Definition at line 35 of file random.H. References srand(). |
|
Generate a random double precision floating point value in the range [0.0, 1.0].
|
|
Gets the current seed value.
Definition at line 52 of file random.H. References _seed. |
|
Generate a random long integer.
Definition at line 60 of file random.H. References _seed, and update(). Referenced by drand(). |
|
Seeds the random number generator with the seed
Definition at line 47 of file random.H. References _seed. Referenced by RandomGen(). |
|
Generate the next seed (i.e. the next random value).
Definition at line 15 of file random.C. References _seed. Referenced by lrand(). |
|
The current seed value.
Definition at line 70 of file random.H. Referenced by get_seed(), lrand(), srand(), and update(). |
|
The maximum integer value that can be produced by this random number generator.
Definition at line 41 of file random.H. Referenced by drand(). |