nag_restore_random_state (g05cgc) (PDF version)
g05 Chapter Contents
g05 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_restore_random_state (g05cgc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_restore_random_state (g05cgc) restores the value of the seed used by the basic generator in Chapter g05 after a previous call to nag_save_random_state (g05cfc).

2  Specification

#include <nag.h>
#include <nagg05.h>
void  nag_restore_random_state (const Integer istate[], const double xstate[], NagError *fail)

3  Description

nag_restore_random_state (g05cgc) restores the state of the basic generator, using information saved by a previous call to nag_save_random_state (g05cfc).

4  References

None.

5  Arguments

1:     istate[9]const IntegerInput
2:     xstate[4]const doubleInput
On entry: information about the generator, which must be unchanged from the previous call of nag_save_random_state (g05cfc).
3:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_STATE_CORRUPT
istate or xstate has been corrupted since the previous call to nag_save_random_state (g05cfc).

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 (g05cgce.c)

9.2  Program Data

None.

9.3  Program Results

Program Results (g05cgce.r)


nag_restore_random_state (g05cgc) (PDF version)
g05 Chapter Contents
g05 Chapter Introduction
NAG C Library Manual

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