nag_random_init_repeatable (g05cbc) (PDF version)
g05 Chapter Contents
g05 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_random_init_repeatable (g05cbc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_random_init_repeatable (g05cbc) sets the seed used by the basic generator in Chapter g05 to a repeatable initial value.

2  Specification

#include <nag.h>
#include <nagg05.h>
void  nag_random_init_repeatable (Integer seed)

3  Description

nag_random_init_repeatable (g05cbc) sets the internal seed used by the basic generator nag_random_continuous_uniform (g05cac) to a value n 0  calculated from the argument seed:
n 0 = 2 seed + 1 .
It then generates the value n 1  and discards it, i.e., the first available value is n 2 .
This function will yield different subsequent sequences of random numbers if called with different values of seed, but the sequences will be repeatable in different runs of the calling program. It should be noted that there is no guarantee of statistical properties between sequences, only within sequences.

4  References

None.

5  Arguments

1:     seedIntegerInput
On entry: a number from which the new seed is to be calculated.

6  Error Indicators and Warnings

None.

7  Accuracy

Not applicable.

8  Further Comments

None.

9  Example

The example program prints the first five pseudorandom real numbers from a uniform distribution between 0 and 1, generated by nag_random_continuous_uniform (g05cac) after initialization by nag_random_init_repeatable (g05cbc).

9.1  Program Text

Program Text (g05cbce.c)

9.2  Program Data

None.

9.3  Program Results

Program Results (g05cbce.r)


nag_random_init_repeatable (g05cbc) (PDF version)
g05 Chapter Contents
g05 Chapter Introduction
NAG C Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012