Go to the first, previous, next, last section, table of contents.

Saving and restoring random number generator state

The above methods ignore 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:

Random: 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.

Random: 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.

Random: void gsl_rng_print_state (const gsl_rng * r)
This function prints a hex-dump of the state of the generator r to stdout. At the moment its only use is for debugging.


Go to the first, previous, next, last section, table of contents.