The following generators are provided for compatibility with
Numerical Recipes. Note that the original Numerical Recipes
functions used single precision while we use double precision. This will
lead to minor discrepancies, but only at the level of single-precision
rounding error. If necessary you can force the returned values to single
precision by storing them in a volatile float
, which prevents the
value being held in a register with double or extended precision. Apart
from this difference the underlying algorithms for the integer part of
the generators are the same.
ran0
implements Park and Miller's MINSTD
algorithm with a modified seeding procedure.
ran1
implements Park and Miller's MINSTD
algorithm with a 32-element Bayes-Durham shuffle box.
ran2
implements a L'Ecuyer combined recursive
generator with a 32-element Bayes-Durham shuffle-box.
ran3
implements Knuth's portable
subtractive generator.