[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
17.8 Reading and writing random number generator state
The library provides functions for reading and writing the random number state to a file as binary data.
- Function: int gsl_rng_fwrite (FILE * stream, const gsl_rng * r)
This function writes the random number state of the random number generator r to the stream stream in binary format. The return value is 0 for success and
GSL_EFAILED
if there was a problem writing to the file. Since the data is written in the native binary format it may not be portable between different architectures.
- Function: int gsl_rng_fread (FILE * stream, gsl_rng * r)
This function reads the random number state into the random number generator r from the open stream stream in binary format. The random number generator r must be preinitialized with the correct random number generator type since type information is not saved. The return value is 0 for success and
GSL_EFAILED
if there was a problem reading from the file. The data is assumed to have been written in the native binary format on the same architecture.