- publishing free software manuals
GNU Scientific Library Reference Manual - Third Edition (v1.12)
by M. Galassi, J. Davies, J. Theiler, B. Gough, G. Jungman, P. Alken, M. Booth, F. Rossi
Paperback (6"x9"), 592 pages, 60 figures
ISBN 0954612078
RRP £24.95 ($39.95)

Get a printed copy>>>

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.
ISBN 0954612078GNU Scientific Library Reference Manual - Third Edition (v1.12)See the print edition