nag_save_random_state (g05cfc) (PDF version)
g05 Chapter Contents
g05 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_save_random_state (g05cfc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_save_random_state (g05cfc) saves the value of the seed used by the basic generator in the g05 Chapter.

2  Specification

#include <nag.h>
#include <nagg05.h>
void  nag_save_random_state (Integer istate[], double xstate[])

3  Description

nag_save_random_state (g05cfc) saves information about the basic generator to enable nag_restore_random_state (g05cgc) subsequently to restore the basic generator to its current state. The values of istate and xstate must not be altered between a call of nag_save_random_state (g05cfc) and a call of nag_restore_random_state (g05cgc).

4  References

None.

5  Arguments

1:     istate[9]IntegerOutput
2:     xstate[4]doubleOutput
On exit: information about the generator.

6  Error Indicators and Warnings

None.

7  Accuracy

Not applicable.

8  Further Comments

None.

9  Example

The program prints 10 pseudorandom numbers generated by nag_random_continuous_uniform (g05cac); it saves the generator state after the 2nd, and restores it after the 7th so that the 8th, 9th and 10th numbers are the same as the 3rd, 4th and 5th.

9.1  Program Text

Program Text (g05cfce.c)

9.2  Program Data

None.

9.3  Program Results

Program Results (g05cfce.r)


nag_save_random_state (g05cfc) (PDF version)
g05 Chapter Contents
g05 Chapter Introduction
NAG C Library Manual

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