GFSR



NAME

     gfsr -  Generalized  feedback  shift  register  pseudorandom
     number generator with uniform distribution over [0,1].


SYNOPSIS

     double GFSR()


     int readGFSR( file )  char *file;


     int writeGFSR( file )  char *file;


DESCRIPTION

     GFSR is a fast pseudorandom number generator with a  uniform
     distribution,  having  a large period that is independent of
     the computer word size.  This implementation uses  a  31-bit
     GFSR  algorithm  for  x^98+x^27+1  to  generate pseudorandom
     double-precision numbers in the range [0,1].  The polynomial
     used  provides  a  period of 2^98 - 1.  The expected mean is
     1/2; the expected variance is 1/12.

     ReadGFSR loads a state  table  from  file  for  use  in  all
     further GFSR calls. WriteGFSR writes the current state table
     to file. To have a program which produces different  numbers
     on  each run, call readGFSR(mytable) at the beginning of the
     program and writeGFSR(mytable) at the end, where mytable  is
     the  name of a file for this use. If readGFSR can't read the
     file requested, it will reset the state to what it was  when
     the program first started.


REFERENCE

     Lewis and Payne.  "Generalized Feedback Shift Register Pseu-
          dorandom Number Algorithm".  Journal of the Association
          for Computing Machinery. July 1973, pp. 456-468.


SEE ALSO

     seqaln-intro(1),  librandist(3),  expdist(3),   normdis
t(3),
     unidist(3).