Functions for generating random numbers.
Description
The routines LALCreateRandomParams()
and LALDestroyRandomParams()
create and destroy a parameter structure for the generation of random variables. The creation routine requires a random number seed seed
. If the seed is zero then a seed is generated using the current time.
The routine LALUniformDeviate()
returns a single random deviate distributed uniformly between zero and unity.
The routine LALNormalDeviates()
fills a vector with normal (Gaussian) deviates with zero mean and unit variance, whereas the functionXLALNormalDeviate
just returns one normal distributed random number.
Operating Instructions
/\* fill vector with uniform deviates *\/
for ( i = 0; i < vector->
length; ++i )
{
}
/\* fill vector with normal deviates *\/
uint32_t UINT4
Four-byte unsigned integer.
int32_t INT4
Four-byte signed integer.
void LALCreateRandomParams(LALStatus *status, RandomParams **params, INT4 seed)
void LALNormalDeviates(LALStatus *status, REAL4Vector *deviates, RandomParams *params)
void LALUniformDeviate(LALStatus *status, REAL4 *deviate, RandomParams *params)
void LALDestroyRandomParams(LALStatus *status, RandomParams **params)
void LALDestroyVector(LALStatus *, REAL4Vector **)
void LALCreateVector(LALStatus *, REAL4Vector **, UINT4)
LAL status structure, see The LALStatus structure for more details.
Vector of type REAL4, see DATATYPE-Vector types for more details.
REAL4 * data
Pointer to the data array.
UINT4 length
Number of elements in array.
This structure contains the parameters necessary for generating the current sequence of random number...
Algorithm
This is an implementation of the random number generators ran1
and gasdev
described in Numerical Recipes [22] .
|
static const INT4 | a = 16807 |
|
static const INT4 | m = 2147483647 |
|
static const INT4 | q = 127773 |
|
static const INT4 | r = 2836 |
|
static const REAL4 | eps = 1.2e-7 |
|
◆ XLALBasicRandom()
◆ XLALCreateRandomParams()
◆ XLALResetRandomParams()
◆ XLALDestroyRandomParams()
◆ XLALUniformDeviate()
◆ XLALNormalDeviates()
◆ XLALNormalDeviate()
◆ LALCreateRandomParams()
◆ LALDestroyRandomParams()
◆ LALUniformDeviate()
◆ LALNormalDeviates()
const INT4 m = 2147483647 |
|
static |
◆ eps