nag_random_continuous_uniform (g05cac) returns a pseudorandom number taken from a uniform distribution between 0 and 1.
nag_random_continuous_uniform (g05cac) returns the next pseudorandom number from the basic uniform (0,1) generator.
The basic generator uses a multiplicative congruential algorithm
The integer
is divided by
to yield a real value
, which is guaranteed to satisfy
The value of
is saved internally in the code. The initial value
is set by default to
, but the sequence may be re-initialized by a call to
nag_random_init_repeatable (g05cbc) for a repeatable sequence, or
nag_random_init_nonrepeatable (g05ccc) for a non-repeatable sequence.
None.
None.
Not applicable.
Its performance has been analysed by the Spectral Test (see Section 3.3.4 of
Knuth (1981)), yielding the following results in the notation of Knuth.
An informal interpretation of the quantities
is that consecutive
-tuples are statistically uncorrelated to an accuracy of
. This is a theoretical result; in practice the degree of randomness is usually much greater than the above figures might support. More details are given in
Knuth (1981), and in the references cited therein.
Note that the achievable statistical independence drops rapidly as the number of dimensions increases. This is a property of all multiplicative congruential generators and is the reason why very long periods are needed even for samples of only a few random numbers.
The example program prints the first five pseudorandom numbers from a uniform distribution between 0 and 1, generated by nag_random_continuous_uniform (g05cac) after initialization by
nag_random_init_repeatable (g05cbc).
None.