Next: , Previous: Random number environment variables, Up: Random Number Generation   [Index]


18.7 Copying random number generator state

The above methods do not expose the random number ‘state’ which changes from call to call. It is often useful to be able to save and restore the state. To permit these practices, a few somewhat more advanced functions are supplied. These include:

Function: int gsl_rng_memcpy (gsl_rng * dest, const gsl_rng * src)

This function copies the random number generator src into the pre-existing generator dest, making dest into an exact copy of src. The two generators must be of the same type.

Function: gsl_rng * gsl_rng_clone (const gsl_rng * r)

This function returns a pointer to a newly created generator which is an exact copy of the generator r.