summaryrefslogtreecommitdiffstats
path: root/gsl-1.9/rng
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-04-08 17:33:11 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-04-08 17:33:11 +0000
commit73f643f3f4a55310b2c8c1a9858906b2dd676e72 (patch)
treeb1df97f18dace4a5702b0bc7aafdfee8a2f25ada /gsl-1.9/rng
parent2011-04-08 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-addon-packages-73f643f3f4a55310b2c8c1a9858906b2dd676e72.tar.bz2
2011-04-08 Joel Sherrill <joel.sherrill@oarcorp.com>
* AUTHORS, BUGS, COPYING, ChangeLog, INSTALL, Makefile.am, Makefile.in, NEWS, README, SUPPORT, THANKS, TODO, acconfig.h, aclocal.m4, autogen.sh, config.guess, config.h.in, config.sub, configure, configure.ac, gsl-config.in, gsl-histogram.c, gsl-randist.c, gsl.m4, gsl.pc.in, gsl.spec.in, gsl_machine.h, gsl_math.h, gsl_mode.h, gsl_nan.h, gsl_pow_int.h, gsl_precision.h, gsl_types.h, gsl_version.h.in, install-sh, ltmain.sh, mdate-sh, missing, mkinstalldirs, templates_off.h, templates_on.h, test_gsl_histogram.sh, version.c, blas/ChangeLog, blas/Makefile.am, blas/Makefile.in, blas/TODO, blas/blas.c, blas/gsl_blas.h, blas/gsl_blas_types.h, block/ChangeLog, block/Makefile.am, block/Makefile.in, block/block.c, block/block_source.c, block/file.c, block/fprintf_source.c, block/fwrite_source.c, block/gsl_block.h, block/gsl_block_char.h, block/gsl_block_complex_double.h, block/gsl_block_complex_float.h, block/gsl_block_complex_long_double.h, block/gsl_block_double.h, block/gsl_block_float.h, block/gsl_block_int.h, block/gsl_block_long.h, block/gsl_block_long_double.h, block/gsl_block_short.h, block/gsl_block_uchar.h, block/gsl_block_uint.h, block/gsl_block_ulong.h, block/gsl_block_ushort.h, block/gsl_check_range.h, block/init.c, block/init_source.c, block/test.c, block/test_complex_io.c, block/test_complex_source.c, block/test_io.c, block/test_source.c, bspline/ChangeLog, bspline/Makefile.am, bspline/Makefile.in, bspline/TODO, bspline/bspline.c, bspline/gsl_bspline.h, bspline/test.c, cblas/ChangeLog, cblas/Makefile.am, cblas/Makefile.in, cblas/TODO, cblas/caxpy.c, cblas/cblas.h, cblas/ccopy.c, cblas/cdotc_sub.c, cblas/cdotu_sub.c, cblas/cgbmv.c, cblas/cgemm.c, cblas/cgemv.c, cblas/cgerc.c, cblas/cgeru.c, cblas/chbmv.c, cblas/chemm.c, cblas/chemv.c, cblas/cher.c, cblas/cher2.c, cblas/cher2k.c, cblas/cherk.c, cblas/chpmv.c, cblas/chpr.c, cblas/chpr2.c, cblas/cscal.c, cblas/csscal.c, cblas/cswap.c, cblas/csymm.c, cblas/csyr2k.c, cblas/csyrk.c, cblas/ctbmv.c, cblas/ctbsv.c, cblas/ctpmv.c, cblas/ctpsv.c, cblas/ctrmm.c, cblas/ctrmv.c, cblas/ctrsm.c, cblas/ctrsv.c, cblas/dasum.c, cblas/daxpy.c, cblas/dcopy.c, cblas/ddot.c, cblas/dgbmv.c, cblas/dgemm.c, cblas/dgemv.c, cblas/dger.c, cblas/dnrm2.c, cblas/drot.c, cblas/drotg.c, cblas/drotm.c, cblas/drotmg.c, cblas/dsbmv.c, cblas/dscal.c, cblas/dsdot.c, cblas/dspmv.c, cblas/dspr.c, cblas/dspr2.c, cblas/dswap.c, cblas/dsymm.c, cblas/dsymv.c, cblas/dsyr.c, cblas/dsyr2.c, cblas/dsyr2k.c, cblas/dsyrk.c, cblas/dtbmv.c, cblas/dtbsv.c, cblas/dtpmv.c, cblas/dtpsv.c, cblas/dtrmm.c, cblas/dtrmv.c, cblas/dtrsm.c, cblas/dtrsv.c, cblas/dzasum.c, cblas/dznrm2.c, cblas/gsl_cblas.h, cblas/hypot.c, cblas/icamax.c, cblas/idamax.c, cblas/isamax.c, cblas/izamax.c, cblas/sasum.c, cblas/saxpy.c, cblas/scasum.c, cblas/scnrm2.c, cblas/scopy.c, cblas/sdot.c, cblas/sdsdot.c, cblas/sgbmv.c, cblas/sgemm.c, cblas/sgemv.c, cblas/sger.c, cblas/snrm2.c, cblas/source_asum_c.h, cblas/source_asum_r.h, cblas/source_axpy_c.h, cblas/source_axpy_r.h, cblas/source_copy_c.h, cblas/source_copy_r.h, cblas/source_dot_c.h, cblas/source_dot_r.h, cblas/source_gbmv_c.h, cblas/source_gbmv_r.h, cblas/source_gemm_c.h, cblas/source_gemm_r.h, cblas/source_gemv_c.h, cblas/source_gemv_r.h, cblas/source_ger.h, cblas/source_gerc.h, cblas/source_geru.h, cblas/source_hbmv.h, cblas/source_hemm.h, cblas/source_hemv.h, cblas/source_her.h, cblas/source_her2.h, cblas/source_her2k.h, cblas/source_herk.h, cblas/source_hpmv.h, cblas/source_hpr.h, cblas/source_hpr2.h, cblas/source_iamax_c.h, cblas/source_iamax_r.h, cblas/source_nrm2_c.h, cblas/source_nrm2_r.h, cblas/source_rot.h, cblas/source_rotg.h, cblas/source_rotm.h, cblas/source_rotmg.h, cblas/source_sbmv.h, cblas/source_scal_c.h, cblas/source_scal_c_s.h, cblas/source_scal_r.h, cblas/source_spmv.h, cblas/source_spr.h, cblas/source_spr2.h, cblas/source_swap_c.h, cblas/source_swap_r.h, cblas/source_symm_c.h, cblas/source_symm_r.h, cblas/source_symv.h, cblas/source_syr.h, cblas/source_syr2.h, cblas/source_syr2k_c.h, cblas/source_syr2k_r.h, cblas/source_syrk_c.h, cblas/source_syrk_r.h, cblas/source_tbmv_c.h, cblas/source_tbmv_r.h, cblas/source_tbsv_c.h, cblas/source_tbsv_r.h, cblas/source_tpmv_c.h, cblas/source_tpmv_r.h, cblas/source_tpsv_c.h, cblas/source_tpsv_r.h, cblas/source_trmm_c.h, cblas/source_trmm_r.h, cblas/source_trmv_c.h, cblas/source_trmv_r.h, cblas/source_trsm_c.h, cblas/source_trsm_r.h, cblas/source_trsv_c.h, cblas/source_trsv_r.h, cblas/srot.c, cblas/srotg.c, cblas/srotm.c, cblas/srotmg.c, cblas/ssbmv.c, cblas/sscal.c, cblas/sspmv.c, cblas/sspr.c, cblas/sspr2.c, cblas/sswap.c, cblas/ssymm.c, cblas/ssymv.c, cblas/ssyr.c, cblas/ssyr2.c, cblas/ssyr2k.c, cblas/ssyrk.c, cblas/stbmv.c, cblas/stbsv.c, cblas/stpmv.c, cblas/stpsv.c, cblas/strmm.c, cblas/strmv.c, cblas/strsm.c, cblas/strsv.c, cblas/test.c, cblas/test_amax.c, cblas/test_asum.c, cblas/test_axpy.c, cblas/test_copy.c, cblas/test_dot.c, cblas/test_gbmv.c, cblas/test_gemm.c, cblas/test_gemv.c, cblas/test_ger.c, cblas/test_hbmv.c, cblas/test_hemm.c, cblas/test_hemv.c, cblas/test_her.c, cblas/test_her2.c, cblas/test_her2k.c, cblas/test_herk.c, cblas/test_hpmv.c, cblas/test_hpr.c, cblas/test_hpr2.c, cblas/test_nrm2.c, cblas/test_rot.c, cblas/test_rotg.c, cblas/test_rotm.c, cblas/test_rotmg.c, cblas/test_sbmv.c, cblas/test_scal.c, cblas/test_spmv.c, cblas/test_spr.c, cblas/test_spr2.c, cblas/test_swap.c, cblas/test_symm.c, cblas/test_symv.c, cblas/test_syr.c, cblas/test_syr2.c, cblas/test_syr2k.c, cblas/test_syrk.c, cblas/test_tbmv.c, cblas/test_tbsv.c, cblas/test_tpmv.c, cblas/test_tpsv.c, cblas/test_trmm.c, cblas/test_trmv.c, cblas/test_trsm.c, cblas/test_trsv.c, cblas/tests.c, cblas/tests.h, cblas/xerbla.c, cblas/zaxpy.c, cblas/zcopy.c, cblas/zdotc_sub.c, cblas/zdotu_sub.c, cblas/zdscal.c, cblas/zgbmv.c, cblas/zgemm.c, cblas/zgemv.c, cblas/zgerc.c, cblas/zgeru.c, cblas/zhbmv.c, cblas/zhemm.c, cblas/zhemv.c, cblas/zher.c, cblas/zher2.c, cblas/zher2k.c, cblas/zherk.c, cblas/zhpmv.c, cblas/zhpr.c, cblas/zhpr2.c, cblas/zscal.c, cblas/zswap.c, cblas/zsymm.c, cblas/zsyr2k.c, cblas/zsyrk.c, cblas/ztbmv.c, cblas/ztbsv.c, cblas/ztpmv.c, cblas/ztpsv.c, cblas/ztrmm.c, cblas/ztrmv.c, cblas/ztrsm.c, cblas/ztrsv.c, cdf/ChangeLog, cdf/Makefile.am, cdf/Makefile.in, cdf/beta.c, cdf/beta_inc.c, cdf/betainv.c, cdf/binomial.c, cdf/cauchy.c, cdf/cauchyinv.c, cdf/chisq.c, cdf/chisqinv.c, cdf/error.h, cdf/exponential.c, cdf/exponentialinv.c, cdf/exppow.c, cdf/fdist.c, cdf/fdistinv.c, cdf/flat.c, cdf/flatinv.c, cdf/gamma.c, cdf/gammainv.c, cdf/gauss.c, cdf/gaussinv.c, cdf/geometric.c, cdf/gsl_cdf.h, cdf/gumbel1.c, cdf/gumbel1inv.c, cdf/gumbel2.c, cdf/gumbel2inv.c, cdf/hypergeometric.c, cdf/laplace.c, cdf/laplaceinv.c, cdf/logistic.c, cdf/logisticinv.c, cdf/lognormal.c, cdf/lognormalinv.c, cdf/nbinomial.c, cdf/pareto.c, cdf/paretoinv.c, cdf/pascal.c, cdf/poisson.c, cdf/rat_eval.h, cdf/rayleigh.c, cdf/rayleighinv.c, cdf/tdist.c, cdf/tdistinv.c, cdf/test.c, cdf/test_auto.c, cdf/weibull.c, cdf/weibullinv.c, cheb/ChangeLog, cheb/Makefile.am, cheb/Makefile.in, cheb/deriv.c, cheb/eval.c, cheb/gsl_chebyshev.h, cheb/init.c, cheb/integ.c, cheb/test.c, combination/ChangeLog, combination/Makefile.am, combination/Makefile.in, combination/combination.c, combination/file.c, combination/gsl_combination.h, combination/init.c, combination/test.c, complex/ChangeLog, complex/Makefile.am, complex/Makefile.in, complex/TODO, complex/gsl_complex.h, complex/gsl_complex_math.h, complex/math.c, complex/results.h, complex/results1.h, complex/results_real.h, complex/test.c, const/ChangeLog, const/Makefile.am, const/Makefile.in, const/TODO, const/gsl_const.h, const/gsl_const_cgs.h, const/gsl_const_cgsm.h, const/gsl_const_mks.h, const/gsl_const_mksa.h, const/gsl_const_num.h, const/test.c, deriv/ChangeLog, deriv/Makefile.am, deriv/Makefile.in, deriv/deriv.c, deriv/gsl_deriv.h, deriv/test.c, dht/ChangeLog, dht/Makefile.am, dht/Makefile.in, dht/dht.c, dht/gsl_dht.h, dht/test.c, diff/ChangeLog, diff/Makefile.am, diff/Makefile.in, diff/diff.c, diff/gsl_diff.h, diff/test.c, doc/12-cities.eps, doc/ChangeLog, doc/Makefile.am, doc/Makefile.in, doc/algorithm.sty, doc/algorithmic.sty, doc/autoconf.texi, doc/blas.texi, doc/bspline.eps, doc/bspline.texi, doc/calc.sty, doc/cblas.texi, doc/cheb.eps, doc/cheb.texi, doc/combination.texi, doc/complex.texi, doc/const.texi, doc/debug.texi, doc/dht.texi, doc/diff.texi, doc/dwt-orig.eps, doc/dwt-samp.eps, doc/dwt.texi, doc/eigen.texi, doc/err.texi, doc/fdl.texi, doc/fft-complex-radix2-f.eps, doc/fft-complex-radix2-t.eps, doc/fft-complex-radix2.eps, doc/fft-real-mixedradix.eps, doc/fft.texi, doc/fftalgorithms.bib, doc/fftalgorithms.tex, doc/final-route.eps, doc/fit-exp.eps, doc/fit-wlinear.eps, doc/fit-wlinear2.eps, doc/fitting.texi, doc/freemanuals.texi, doc/gpl.texi, doc/gsl-config.1, doc/gsl-design.texi, doc/gsl-histogram.1, doc/gsl-randist.1, doc/gsl-ref.info, doc/gsl-ref.info-1, doc/gsl-ref.info-2, doc/gsl-ref.info-3, doc/gsl-ref.info-4, doc/gsl-ref.info-5, doc/gsl-ref.info-6, doc/gsl-ref.texi, doc/gsl.3, doc/histogram.eps, doc/histogram.texi, doc/histogram2d.eps, doc/ieee754.texi, doc/initial-route.eps, doc/integration.texi, doc/interp.texi, doc/interp2.eps, doc/interpp2.eps, doc/intro.texi, doc/landau.dat, doc/linalg.texi, doc/math.texi, doc/mdate-sh, doc/min-interval.eps, doc/min.texi, doc/montecarlo.texi, doc/multifit.texi, doc/multimin.eps, doc/multimin.texi, doc/multiroots.texi, doc/ntuple.eps, doc/ntuple.texi, doc/ode-initval.texi, doc/permutation.texi, doc/poly.texi, doc/qrng.eps, doc/qrng.texi, doc/rand-bernoulli.tex, doc/rand-beta.tex, doc/rand-binomial.tex, doc/rand-bivariate-gaussian.tex, doc/rand-cauchy.tex, doc/rand-chisq.tex, doc/rand-erlang.tex, doc/rand-exponential.tex, doc/rand-exppow.tex, doc/rand-fdist.tex, doc/rand-flat.tex, doc/rand-gamma.tex, doc/rand-gaussian-tail.tex, doc/rand-gaussian.tex, doc/rand-geometric.tex, doc/rand-gumbel.tex, doc/rand-gumbel1.tex, doc/rand-gumbel2.tex, doc/rand-hypergeometric.tex, doc/rand-landau.tex, doc/rand-laplace.tex, doc/rand-levy.tex, doc/rand-levyskew.tex, doc/rand-logarithmic.tex, doc/rand-logistic.tex, doc/rand-lognormal.tex, doc/rand-nbinomial.tex, doc/rand-pareto.tex, doc/rand-pascal.tex, doc/rand-poisson.tex, doc/rand-rayleigh-tail.tex, doc/rand-rayleigh.tex, doc/rand-tdist.tex, doc/rand-weibull.tex, doc/randist.texi, doc/random-walk.tex, doc/randplots.gnp, doc/rng.texi, doc/roots-bisection.eps, doc/roots-false-position.eps, doc/roots-newtons-method.eps, doc/roots-secant-method.eps, doc/roots.texi, doc/siman-energy.eps, doc/siman-test.eps, doc/siman.texi, doc/sort.texi, doc/specfunc-airy.texi, doc/specfunc-bessel.texi, doc/specfunc-clausen.texi, doc/specfunc-coulomb.texi, doc/specfunc-coupling.texi, doc/specfunc-dawson.texi, doc/specfunc-debye.texi, doc/specfunc-dilog.texi, doc/specfunc-elementary.texi, doc/specfunc-ellint.texi, doc/specfunc-elljac.texi, doc/specfunc-erf.texi, doc/specfunc-exp.texi, doc/specfunc-expint.texi, doc/specfunc-fermi-dirac.texi, doc/specfunc-gamma.texi, doc/specfunc-gegenbauer.texi, doc/specfunc-hyperg.texi, doc/specfunc-laguerre.texi, doc/specfunc-lambert.texi, doc/specfunc-legendre.texi, doc/specfunc-log.texi, doc/specfunc-mathieu.texi, doc/specfunc-pow-int.texi, doc/specfunc-psi.texi, doc/specfunc-synchrotron.texi, doc/specfunc-transport.texi, doc/specfunc-trig.texi, doc/specfunc-zeta.texi, doc/specfunc.texi, doc/stamp-vti, doc/statistics.texi, doc/sum.texi, doc/texinfo.tex, doc/usage.texi, doc/vdp.eps, doc/vectors.texi, doc/version-ref.texi, doc/examples/blas.c, doc/examples/blas.out, doc/examples/block.c, doc/examples/block.out, doc/examples/bspline.c, doc/examples/cblas.c, doc/examples/cblas.out, doc/examples/cdf.c, doc/examples/cdf.out, doc/examples/cheb.c, doc/examples/combination.c, doc/examples/combination.out, doc/examples/const.c, doc/examples/const.out, doc/examples/demo_fn.c, doc/examples/demo_fn.h, doc/examples/diff.c, doc/examples/diff.out, doc/examples/dwt.c, doc/examples/dwt.dat, doc/examples/ecg.dat, doc/examples/eigen.c, doc/examples/eigen_nonsymm.c, doc/examples/expfit.c, doc/examples/fft.c, doc/examples/fftmr.c, doc/examples/fftreal.c, doc/examples/fitting.c, doc/examples/fitting2.c, doc/examples/fitting3.c, doc/examples/histogram.c, doc/examples/histogram2d.c, doc/examples/ieee.c, doc/examples/ieeeround.c, doc/examples/integration.c, doc/examples/integration.out, doc/examples/interp.c, doc/examples/interpp.c, doc/examples/intro.c, doc/examples/intro.out, doc/examples/linalglu.c, doc/examples/linalglu.out, doc/examples/matrix.c, doc/examples/matrixw.c, doc/examples/min.c, doc/examples/min.out, doc/examples/monte.c, doc/examples/nlfit.c, doc/examples/ntupler.c, doc/examples/ntuplew.c, doc/examples/ode-initval.c, doc/examples/odefixed.c, doc/examples/permseq.c, doc/examples/permshuffle.c, doc/examples/polyroots.c, doc/examples/polyroots.out, doc/examples/qrng.c, doc/examples/randpoisson.2.out, doc/examples/randpoisson.c, doc/examples/randpoisson.out, doc/examples/randwalk.c, doc/examples/rng.c, doc/examples/rng.out, doc/examples/rngunif.2.out, doc/examples/rngunif.c, doc/examples/rngunif.out, doc/examples/rootnewt.c, doc/examples/roots.c, doc/examples/siman.c, doc/examples/sortsmall.c, doc/examples/sortsmall.out, doc/examples/specfun.c, doc/examples/specfun.out, doc/examples/specfun_e.c, doc/examples/specfun_e.out, doc/examples/stat.c, doc/examples/stat.out, doc/examples/statsort.c, doc/examples/statsort.out, doc/examples/sum.c, doc/examples/sum.out, doc/examples/vector.c, doc/examples/vectorr.c, doc/examples/vectorview.c, doc/examples/vectorview.out, doc/examples/vectorw.c, eigen/ChangeLog, eigen/Makefile.am, eigen/Makefile.in, eigen/TODO, eigen/francis.c, eigen/gsl_eigen.h, eigen/herm.c, eigen/hermv.c, eigen/jacobi.c, eigen/nonsymm.c, eigen/nonsymmv.c, eigen/qrstep.c, eigen/schur.c, eigen/schur.h, eigen/sort.c, eigen/symm.c, eigen/symmv.c, eigen/test.c, err/ChangeLog, err/Makefile.am, err/Makefile.in, err/TODO, err/error.c, err/gsl_errno.h, err/gsl_message.h, err/message.c, err/stream.c, err/strerror.c, err/test.c, fft/ChangeLog, fft/Makefile.am, fft/Makefile.in, fft/TODO, fft/bitreverse.c, fft/bitreverse.h, fft/c_init.c, fft/c_main.c, fft/c_pass.h, fft/c_pass_2.c, fft/c_pass_3.c, fft/c_pass_4.c, fft/c_pass_5.c, fft/c_pass_6.c, fft/c_pass_7.c, fft/c_pass_n.c, fft/c_radix2.c, fft/compare.h, fft/compare_source.c, fft/complex_internal.h, fft/dft.c, fft/dft_source.c, fft/factorize.c, fft/factorize.h, fft/fft.c, fft/gsl_dft_complex.h, fft/gsl_dft_complex_float.h, fft/gsl_fft.h, fft/gsl_fft_complex.h, fft/gsl_fft_complex_float.h, fft/gsl_fft_halfcomplex.h, fft/gsl_fft_halfcomplex_float.h, fft/gsl_fft_real.h, fft/gsl_fft_real_float.h, fft/hc_init.c, fft/hc_main.c, fft/hc_pass.h, fft/hc_pass_2.c, fft/hc_pass_3.c, fft/hc_pass_4.c, fft/hc_pass_5.c, fft/hc_pass_n.c, fft/hc_radix2.c, fft/hc_unpack.c, fft/real_init.c, fft/real_main.c, fft/real_pass.h, fft/real_pass_2.c, fft/real_pass_3.c, fft/real_pass_4.c, fft/real_pass_5.c, fft/real_pass_n.c, fft/real_radix2.c, fft/real_unpack.c, fft/signals.c, fft/signals.h, fft/signals_source.c, fft/test.c, fft/test_complex_source.c, fft/test_real_source.c, fft/test_trap_source.c, fft/urand.c, fit/ChangeLog, fit/Makefile.am, fit/Makefile.in, fit/gsl_fit.h, fit/linear.c, fit/test.c, gsl/Makefile.am, gsl/Makefile.in, histogram/ChangeLog, histogram/Makefile.am, histogram/Makefile.in, histogram/TODO, histogram/add.c, histogram/add2d.c, histogram/calloc_range.c, histogram/calloc_range2d.c, histogram/copy.c, histogram/copy2d.c, histogram/file.c, histogram/file2d.c, histogram/find.c, histogram/find2d.c, histogram/get.c, histogram/get2d.c, histogram/gsl_histogram.h, histogram/gsl_histogram2d.h, histogram/init.c, histogram/init2d.c, histogram/maxval.c, histogram/maxval2d.c, histogram/oper.c, histogram/oper2d.c, histogram/params.c, histogram/params2d.c, histogram/pdf.c, histogram/pdf2d.c, histogram/reset.c, histogram/reset2d.c, histogram/stat.c, histogram/stat2d.c, histogram/test.c, histogram/test1d.c, histogram/test1d_resample.c, histogram/test1d_trap.c, histogram/test2d.c, histogram/test2d_resample.c, histogram/test2d_trap.c, histogram/urand.c, ieee-utils/ChangeLog, ieee-utils/Makefile.am, ieee-utils/Makefile.in, ieee-utils/TODO, ieee-utils/endian.c, ieee-utils/env.c, ieee-utils/fp-aix.c, ieee-utils/fp-darwin.c, ieee-utils/fp-darwin86.c, ieee-utils/fp-freebsd.c, ieee-utils/fp-gnuc99.c, ieee-utils/fp-gnum68k.c, ieee-utils/fp-gnuppc.c, ieee-utils/fp-gnusparc.c, ieee-utils/fp-gnux86.c, ieee-utils/fp-hpux.c, ieee-utils/fp-hpux11.c, ieee-utils/fp-irix.c, ieee-utils/fp-netbsd.c, ieee-utils/fp-openbsd.c, ieee-utils/fp-os2emx.c, ieee-utils/fp-solaris.c, ieee-utils/fp-sunos4.c, ieee-utils/fp-tru64.c, ieee-utils/fp-unknown.c, ieee-utils/fp.c, ieee-utils/gsl_ieee_utils.h, ieee-utils/make_rep.c, ieee-utils/print.c, ieee-utils/read.c, ieee-utils/standardize.c, ieee-utils/test.c, integration/ChangeLog, integration/Makefile.am, integration/Makefile.in, integration/TODO, integration/append.c, integration/err.c, integration/gsl_integration.h, integration/initialise.c, integration/positivity.c, integration/ptsort.c, integration/qag.c, integration/qagp.c, integration/qags.c, integration/qawc.c, integration/qawf.c, integration/qawo.c, integration/qaws.c, integration/qc25c.c, integration/qc25f.c, integration/qc25s.c, integration/qcheb.c, integration/qelg.c, integration/qk.c, integration/qk15.c, integration/qk21.c, integration/qk31.c, integration/qk41.c, integration/qk51.c, integration/qk61.c, integration/qmomo.c, integration/qmomof.c, integration/qng.c, integration/qng.h, integration/qpsrt.c, integration/qpsrt2.c, integration/reset.c, integration/set_initial.c, integration/test.c, integration/tests.c, integration/tests.h, integration/util.c, integration/workspace.c, interpolation/ChangeLog, interpolation/Makefile.am, interpolation/Makefile.in, interpolation/TODO, interpolation/accel.c, interpolation/akima.c, interpolation/bsearch.c, interpolation/bsearch.h, interpolation/cspline.c, interpolation/gsl_interp.h, interpolation/gsl_spline.h, interpolation/integ_eval.h, interpolation/interp.c, interpolation/linear.c, interpolation/poly.c, interpolation/spline.c, interpolation/test.c, linalg/ChangeLog, linalg/Makefile.am, linalg/Makefile.in, linalg/TODO, linalg/apply_givens.c, linalg/balance.c, linalg/balancemat.c, linalg/bidiag.c, linalg/cholesky.c, linalg/exponential.c, linalg/givens.c, linalg/gsl_linalg.h, linalg/hermtd.c, linalg/hessenberg.c, linalg/hh.c, linalg/householder.c, linalg/householdercomplex.c, linalg/lq.c, linalg/lu.c, linalg/luc.c, linalg/multiply.c, linalg/ptlq.c, linalg/qr.c, linalg/qrpt.c, linalg/svd.c, linalg/svdstep.c, linalg/symmtd.c, linalg/test.c, linalg/tridiag.c, linalg/tridiag.h, matrix/ChangeLog, matrix/Makefile.am, matrix/Makefile.in, matrix/TODO, matrix/copy.c, matrix/copy_source.c, matrix/file.c, matrix/file_source.c, matrix/getset.c, matrix/getset_source.c, matrix/gsl_matrix.h, matrix/gsl_matrix_char.h, matrix/gsl_matrix_complex_double.h, matrix/gsl_matrix_complex_float.h, matrix/gsl_matrix_complex_long_double.h, matrix/gsl_matrix_double.h, matrix/gsl_matrix_float.h, matrix/gsl_matrix_int.h, matrix/gsl_matrix_long.h, matrix/gsl_matrix_long_double.h, matrix/gsl_matrix_short.h, matrix/gsl_matrix_uchar.h, matrix/gsl_matrix_uint.h, matrix/gsl_matrix_ulong.h, matrix/gsl_matrix_ushort.h, matrix/init.c, matrix/init_source.c, matrix/matrix.c, matrix/matrix_source.c, matrix/minmax.c, matrix/minmax_source.c, matrix/oper.c, matrix/oper_complex_source.c, matrix/oper_source.c, matrix/prop.c, matrix/prop_source.c, matrix/rowcol.c, matrix/rowcol_source.c, matrix/submatrix.c, matrix/submatrix_source.c, matrix/swap.c, matrix/swap_source.c, matrix/test.c, matrix/test_complex_source.c, matrix/test_source.c, matrix/test_static.c, matrix/view.c, matrix/view.h, matrix/view_source.c, min/ChangeLog, min/Makefile.am, min/Makefile.in, min/bracketing.c, min/brent.c, min/convergence.c, min/fsolver.c, min/golden.c, min/gsl_min.h, min/min.h, min/test.c, min/test.h, min/test_funcs.c, monte/ChangeLog, monte/Makefile.am, monte/Makefile.in, monte/README, monte/TODO, monte/gsl_monte.h, monte/gsl_monte_miser.h, monte/gsl_monte_plain.h, monte/gsl_monte_vegas.h, monte/miser.c, monte/plain.c, monte/test.c, monte/test_main.c, monte/vegas.c, multifit/ChangeLog, multifit/Makefile.am, multifit/Makefile.in, multifit/TODO, multifit/convergence.c, multifit/covar.c, multifit/fdfsolver.c, multifit/fsolver.c, multifit/gradient.c, multifit/gsl_multifit.h, multifit/gsl_multifit_nlin.h, multifit/lmder.c, multifit/lmiterate.c, multifit/lmpar.c, multifit/lmset.c, multifit/lmutil.c, multifit/multilinear.c, multifit/qrsolv.c, multifit/test.c, multifit/test_brown.c, multifit/test_enso.c, multifit/test_estimator.c, multifit/test_filip.c, multifit/test_fn.c, multifit/test_hahn1.c, multifit/test_kirby2.c, multifit/test_longley.c, multifit/test_nelson.c, multifit/test_pontius.c, multifit/work.c, multimin/ChangeLog, multimin/Makefile.am, multimin/Makefile.in, multimin/TODO, multimin/conjugate_fr.c, multimin/conjugate_pr.c, multimin/convergence.c, multimin/diff.c, multimin/directional_minimize.c, multimin/fdfminimizer.c, multimin/fminimizer.c, multimin/gsl_multimin.h, multimin/linear_minimize.c, multimin/linear_wrapper.c, multimin/simplex.c, multimin/steepest_descent.c, multimin/test.c, multimin/test_funcs.c, multimin/test_funcs.h, multimin/vector_bfgs.c, multimin/vector_bfgs2.c, multiroots/ChangeLog, multiroots/Makefile.am, multiroots/Makefile.in, multiroots/broyden.c, multiroots/convergence.c, multiroots/dnewton.c, multiroots/dogleg.c, multiroots/enorm.c, multiroots/fdfsolver.c, multiroots/fdjac.c, multiroots/fsolver.c, multiroots/gnewton.c, multiroots/gsl_multiroots.h, multiroots/hybrid.c, multiroots/hybridj.c, multiroots/newton.c, multiroots/test.c, multiroots/test_funcs.c, multiroots/test_funcs.h, ntuple/ChangeLog, ntuple/Makefile.am, ntuple/Makefile.in, ntuple/gsl_ntuple.h, ntuple/ntuple.c, ntuple/test.c, ode-initval/ChangeLog, ode-initval/Makefile.am, ode-initval/Makefile.in, ode-initval/TODO, ode-initval/bsimp.c, ode-initval/control.c, ode-initval/cscal.c, ode-initval/cstd.c, ode-initval/evolve.c, ode-initval/gear1.c, ode-initval/gear2.c, ode-initval/gsl_odeiv.h, ode-initval/odeiv_util.h, ode-initval/rk2.c, ode-initval/rk2imp.c, ode-initval/rk2simp.c, ode-initval/rk4.c, ode-initval/rk4imp.c, ode-initval/rk8pd.c, ode-initval/rkck.c, ode-initval/rkf45.c, ode-initval/step.c, ode-initval/test.c, permutation/ChangeLog, permutation/Makefile.am, permutation/Makefile.in, permutation/canonical.c, permutation/file.c, permutation/gsl_permutation.h, permutation/gsl_permute.h, permutation/gsl_permute_char.h, permutation/gsl_permute_complex_double.h, permutation/gsl_permute_complex_float.h, permutation/gsl_permute_complex_long_double.h, permutation/gsl_permute_double.h, permutation/gsl_permute_float.h, permutation/gsl_permute_int.h, permutation/gsl_permute_long.h, permutation/gsl_permute_long_double.h, permutation/gsl_permute_short.h, permutation/gsl_permute_uchar.h, permutation/gsl_permute_uint.h, permutation/gsl_permute_ulong.h, permutation/gsl_permute_ushort.h, permutation/gsl_permute_vector.h, permutation/gsl_permute_vector_char.h, permutation/gsl_permute_vector_complex_double.h, permutation/gsl_permute_vector_complex_float.h, permutation/gsl_permute_vector_complex_long_double.h, permutation/gsl_permute_vector_double.h, permutation/gsl_permute_vector_float.h, permutation/gsl_permute_vector_int.h, permutation/gsl_permute_vector_long.h, permutation/gsl_permute_vector_long_double.h, permutation/gsl_permute_vector_short.h, permutation/gsl_permute_vector_uchar.h, permutation/gsl_permute_vector_uint.h, permutation/gsl_permute_vector_ulong.h, permutation/gsl_permute_vector_ushort.h, permutation/init.c, permutation/permutation.c, permutation/permute.c, permutation/permute_source.c, permutation/test.c, poly/ChangeLog, poly/Makefile.am, poly/Makefile.in, poly/TODO, poly/balance.c, poly/companion.c, poly/dd.c, poly/eval.c, poly/gsl_poly.h, poly/qr.c, poly/solve_cubic.c, poly/solve_quadratic.c, poly/test.c, poly/zsolve.c, poly/zsolve_cubic.c, poly/zsolve_init.c, poly/zsolve_quadratic.c, qrng/ChangeLog, qrng/Makefile.am, qrng/Makefile.in, qrng/TODO, qrng/gsl_qrng.h, qrng/niederreiter-2.c, qrng/qrng.c, qrng/sobol.c, qrng/test.c, randist/ChangeLog, randist/Makefile.am, randist/Makefile.in, randist/TODO, randist/bernoulli.c, randist/beta.c, randist/bigauss.c, randist/binomial.c, randist/binomial_tpe.c, randist/cauchy.c, randist/chisq.c, randist/dirichlet.c, randist/discrete.c, randist/erlang.c, randist/exponential.c, randist/exppow.c, randist/fdist.c, randist/flat.c, randist/gamma.c, randist/gauss.c, randist/gausstail.c, randist/gausszig.c, randist/geometric.c, randist/gsl_randist.h, randist/gumbel.c, randist/hyperg.c, randist/landau.c, randist/laplace.c, randist/levy.c, randist/logarithmic.c, randist/logistic.c, randist/lognormal.c, randist/multinomial.c, randist/nbinomial.c, randist/pareto.c, randist/pascal.c, randist/poisson.c, randist/rayleigh.c, randist/shuffle.c, randist/sphere.c, randist/tdist.c, randist/test.c, randist/weibull.c, rng/ChangeLog, rng/Makefile.am, rng/Makefile.in, rng/TODO, rng/borosh13.c, rng/cmrg.c, rng/coveyou.c, rng/default.c, rng/file.c, rng/fishman18.c, rng/fishman20.c, rng/fishman2x.c, rng/gfsr4.c, rng/gsl_rng.h, rng/knuthran.c, rng/knuthran2.c, rng/knuthran2002.c, rng/lecuyer21.c, rng/minstd.c, rng/mrg.c, rng/mt.c, rng/r250.c, rng/ran0.c, rng/ran1.c, rng/ran2.c, rng/ran3.c, rng/rand.c, rng/rand48.c, rng/random.c, rng/randu.c, rng/ranf.c, rng/ranlux.c, rng/ranlxd.c, rng/ranlxs.c, rng/ranmar.c, rng/rng.c, rng/schrage.c, rng/slatec.c, rng/taus.c, rng/taus113.c, rng/test.c, rng/transputer.c, rng/tt.c, rng/types.c, rng/uni.c, rng/uni32.c, rng/vax.c, rng/waterman14.c, rng/zuf.c, roots/ChangeLog, roots/Makefile.am, roots/Makefile.in, roots/TODO, roots/bisection.c, roots/brent.c, roots/convergence.c, roots/falsepos.c, roots/fdfsolver.c, roots/fsolver.c, roots/gsl_roots.h, roots/newton.c, roots/roots.h, roots/secant.c, roots/steffenson.c, roots/test.c, roots/test.h, roots/test_funcs.c, siman/ChangeLog, siman/Makefile.am, siman/Makefile.in, siman/TODO, siman/gsl_siman.h, siman/siman.c, siman/siman_test_driver.sh, siman/siman_tsp.c, siman/test.c, sort/ChangeLog, sort/Makefile.am, sort/Makefile.in, sort/TODO, sort/gsl_heapsort.h, sort/gsl_sort.h, sort/gsl_sort_char.h, sort/gsl_sort_double.h, sort/gsl_sort_float.h, sort/gsl_sort_int.h, sort/gsl_sort_long.h, sort/gsl_sort_long_double.h, sort/gsl_sort_short.h, sort/gsl_sort_uchar.h, sort/gsl_sort_uint.h, sort/gsl_sort_ulong.h, sort/gsl_sort_ushort.h, sort/gsl_sort_vector.h, sort/gsl_sort_vector_char.h, sort/gsl_sort_vector_double.h, sort/gsl_sort_vector_float.h, sort/gsl_sort_vector_int.h, sort/gsl_sort_vector_long.h, sort/gsl_sort_vector_long_double.h, sort/gsl_sort_vector_short.h, sort/gsl_sort_vector_uchar.h, sort/gsl_sort_vector_uint.h, sort/gsl_sort_vector_ulong.h, sort/gsl_sort_vector_ushort.h, sort/sort.c, sort/sortind.c, sort/sortvec.c, sort/sortvec_source.c, sort/sortvecind.c, sort/sortvecind_source.c, sort/subset.c, sort/subset_source.c, sort/subsetind.c, sort/subsetind_source.c, sort/test.c, sort/test_heapsort.c, sort/test_source.c, specfunc/ChangeLog, specfunc/Makefile.am, specfunc/Makefile.in, specfunc/TODO, specfunc/airy.c, specfunc/airy_der.c, specfunc/airy_zero.c, specfunc/atanint.c, specfunc/bessel.c, specfunc/bessel.h, specfunc/bessel_I0.c, specfunc/bessel_I1.c, specfunc/bessel_In.c, specfunc/bessel_Inu.c, specfunc/bessel_J0.c, specfunc/bessel_J1.c, specfunc/bessel_Jn.c, specfunc/bessel_Jnu.c, specfunc/bessel_K0.c, specfunc/bessel_K1.c, specfunc/bessel_Kn.c, specfunc/bessel_Knu.c, specfunc/bessel_Y0.c, specfunc/bessel_Y1.c, specfunc/bessel_Yn.c, specfunc/bessel_Ynu.c, specfunc/bessel_amp_phase.c, specfunc/bessel_amp_phase.h, specfunc/bessel_i.c, specfunc/bessel_j.c, specfunc/bessel_k.c, specfunc/bessel_olver.c, specfunc/bessel_olver.h, specfunc/bessel_sequence.c, specfunc/bessel_temme.c, specfunc/bessel_temme.h, specfunc/bessel_y.c, specfunc/bessel_zero.c, specfunc/beta.c, specfunc/beta_inc.c, specfunc/cheb_eval.c, specfunc/cheb_eval_mode.c, specfunc/chebyshev.h, specfunc/check.h, specfunc/clausen.c, specfunc/coulomb.c, specfunc/coulomb_bound.c, specfunc/coupling.c, specfunc/dawson.c, specfunc/debye.c, specfunc/dilog.c, specfunc/elementary.c, specfunc/ellint.c, specfunc/elljac.c, specfunc/erfc.c, specfunc/error.h, specfunc/eval.h, specfunc/exp.c, specfunc/expint.c, specfunc/expint3.c, specfunc/fermi_dirac.c, specfunc/gamma.c, specfunc/gamma_inc.c, specfunc/gegenbauer.c, specfunc/gsl_sf.h, specfunc/gsl_sf_airy.h, specfunc/gsl_sf_bessel.h, specfunc/gsl_sf_clausen.h, specfunc/gsl_sf_coulomb.h, specfunc/gsl_sf_coupling.h, specfunc/gsl_sf_dawson.h, specfunc/gsl_sf_debye.h, specfunc/gsl_sf_dilog.h, specfunc/gsl_sf_elementary.h, specfunc/gsl_sf_ellint.h, specfunc/gsl_sf_elljac.h, specfunc/gsl_sf_erf.h, specfunc/gsl_sf_exp.h, specfunc/gsl_sf_expint.h, specfunc/gsl_sf_fermi_dirac.h, specfunc/gsl_sf_gamma.h, specfunc/gsl_sf_gegenbauer.h, specfunc/gsl_sf_hyperg.h, specfunc/gsl_sf_laguerre.h, specfunc/gsl_sf_lambert.h, specfunc/gsl_sf_legendre.h, specfunc/gsl_sf_log.h, specfunc/gsl_sf_mathieu.h, specfunc/gsl_sf_pow_int.h, specfunc/gsl_sf_psi.h, specfunc/gsl_sf_result.h, specfunc/gsl_sf_synchrotron.h, specfunc/gsl_sf_transport.h, specfunc/gsl_sf_trig.h, specfunc/gsl_sf_zeta.h, specfunc/gsl_specfunc.h, specfunc/hyperg.c, specfunc/hyperg.h, specfunc/hyperg_0F1.c, specfunc/hyperg_1F1.c, specfunc/hyperg_2F0.c, specfunc/hyperg_2F1.c, specfunc/hyperg_U.c, specfunc/laguerre.c, specfunc/lambert.c, specfunc/legendre.h, specfunc/legendre_H3d.c, specfunc/legendre_Qn.c, specfunc/legendre_con.c, specfunc/legendre_poly.c, specfunc/log.c, specfunc/mathieu_angfunc.c, specfunc/mathieu_charv.c, specfunc/mathieu_coeff.c, specfunc/mathieu_radfunc.c, specfunc/mathieu_workspace.c, specfunc/poch.c, specfunc/pow_int.c, specfunc/psi.c, specfunc/recurse.h, specfunc/result.c, specfunc/shint.c, specfunc/sinint.c, specfunc/synchrotron.c, specfunc/test_airy.c, specfunc/test_bessel.c, specfunc/test_coulomb.c, specfunc/test_dilog.c, specfunc/test_gamma.c, specfunc/test_hyperg.c, specfunc/test_legendre.c, specfunc/test_mathieu.c, specfunc/test_sf.c, specfunc/test_sf.h, specfunc/transport.c, specfunc/trig.c, specfunc/zeta.c, statistics/ChangeLog, statistics/Makefile.am, statistics/Makefile.in, statistics/TODO, statistics/absdev.c, statistics/absdev_source.c, statistics/covariance.c, statistics/covariance_source.c, statistics/gsl_statistics.h, statistics/gsl_statistics_char.h, statistics/gsl_statistics_double.h, statistics/gsl_statistics_float.h, statistics/gsl_statistics_int.h, statistics/gsl_statistics_long.h, statistics/gsl_statistics_long_double.h, statistics/gsl_statistics_short.h, statistics/gsl_statistics_uchar.h, statistics/gsl_statistics_uint.h, statistics/gsl_statistics_ulong.h, statistics/gsl_statistics_ushort.h, statistics/kurtosis.c, statistics/kurtosis_source.c, statistics/lag1.c, statistics/lag1_source.c, statistics/mean.c, statistics/mean_source.c, statistics/median.c, statistics/median_source.c, statistics/minmax.c, statistics/minmax_source.c, statistics/p_variance.c, statistics/p_variance_source.c, statistics/quantiles.c, statistics/quantiles_source.c, statistics/skew.c, statistics/skew_source.c, statistics/test.c, statistics/test_float_source.c, statistics/test_int_source.c, statistics/test_nist.c, statistics/ttest.c, statistics/ttest_source.c, statistics/variance.c, statistics/variance_source.c, statistics/wabsdev.c, statistics/wabsdev_source.c, statistics/wkurtosis.c, statistics/wkurtosis_source.c, statistics/wmean.c, statistics/wmean_source.c, statistics/wskew.c, statistics/wskew_source.c, statistics/wvariance.c, statistics/wvariance_source.c, sum/ChangeLog, sum/Makefile.am, sum/Makefile.in, sum/gsl_sum.h, sum/levin_u.c, sum/levin_utrunc.c, sum/test.c, sum/work_u.c, sum/work_utrunc.c, sys/ChangeLog, sys/Makefile.am, sys/Makefile.in, sys/coerce.c, sys/expm1.c, sys/fcmp.c, sys/fdiv.c, sys/gsl_sys.h, sys/hypot.c, sys/infnan.c, sys/invhyp.c, sys/ldfrexp.c, sys/log1p.c, sys/minmax.c, sys/pow_int.c, sys/prec.c, sys/test.c, test/ChangeLog, test/Makefile.am, test/Makefile.in, test/gsl_test.h, test/results.c, utils/Makefile.am, utils/Makefile.in, utils/README, utils/memcpy.c, utils/memmove.c, utils/placeholder.c, utils/strdup.c, utils/strtol.c, utils/strtoul.c, utils/system.h, vector/ChangeLog, vector/Makefile.am, vector/Makefile.in, vector/TODO, vector/copy.c, vector/copy_source.c, vector/file.c, vector/file_source.c, vector/gsl_vector.h, vector/gsl_vector_char.h, vector/gsl_vector_complex.h, vector/gsl_vector_complex_double.h, vector/gsl_vector_complex_float.h, vector/gsl_vector_complex_long_double.h, vector/gsl_vector_double.h, vector/gsl_vector_float.h, vector/gsl_vector_int.h, vector/gsl_vector_long.h, vector/gsl_vector_long_double.h, vector/gsl_vector_short.h, vector/gsl_vector_uchar.h, vector/gsl_vector_uint.h, vector/gsl_vector_ulong.h, vector/gsl_vector_ushort.h, vector/init.c, vector/init_source.c, vector/minmax.c, vector/minmax_source.c, vector/oper.c, vector/oper_source.c, vector/prop.c, vector/prop_source.c, vector/reim.c, vector/reim_source.c, vector/subvector.c, vector/subvector_source.c, vector/swap.c, vector/swap_source.c, vector/test.c, vector/test_complex_source.c, vector/test_source.c, vector/test_static.c, vector/vector.c, vector/vector_source.c, vector/view.c, vector/view.h, vector/view_source.c, wavelet/ChangeLog, wavelet/Makefile.am, wavelet/Makefile.in, wavelet/TODO, wavelet/bspline.c, wavelet/daubechies.c, wavelet/dwt.c, wavelet/gsl_wavelet.h, wavelet/gsl_wavelet2d.h, wavelet/haar.c, wavelet/test.c, wavelet/wavelet.c: New files.
Diffstat (limited to 'gsl-1.9/rng')
-rw-r--r--gsl-1.9/rng/ChangeLog377
-rw-r--r--gsl-1.9/rng/Makefile.am22
-rw-r--r--gsl-1.9/rng/Makefile.in558
-rw-r--r--gsl-1.9/rng/TODO97
-rw-r--r--gsl-1.9/rng/borosh13.c92
-rw-r--r--gsl-1.9/rng/cmrg.c197
-rw-r--r--gsl-1.9/rng/coveyou.c92
-rw-r--r--gsl-1.9/rng/default.c93
-rw-r--r--gsl-1.9/rng/file.c57
-rw-r--r--gsl-1.9/rng/fishman18.c95
-rw-r--r--gsl-1.9/rng/fishman20.c103
-rw-r--r--gsl-1.9/rng/fishman2x.c121
-rw-r--r--gsl-1.9/rng/gfsr4.c165
-rw-r--r--gsl-1.9/rng/gsl_rng.h218
-rw-r--r--gsl-1.9/rng/knuthran.c177
-rw-r--r--gsl-1.9/rng/knuthran2.c103
-rw-r--r--gsl-1.9/rng/knuthran2002.c189
-rw-r--r--gsl-1.9/rng/lecuyer21.c99
-rw-r--r--gsl-1.9/rng/minstd.c109
-rw-r--r--gsl-1.9/rng/mrg.c149
-rw-r--r--gsl-1.9/rng/mt.c241
-rw-r--r--gsl-1.9/rng/r250.c172
-rw-r--r--gsl-1.9/rng/ran0.c100
-rw-r--r--gsl-1.9/rng/ran1.c130
-rw-r--r--gsl-1.9/rng/ran2.c146
-rw-r--r--gsl-1.9/rng/ran3.c132
-rw-r--r--gsl-1.9/rng/rand.c85
-rw-r--r--gsl-1.9/rng/rand48.c143
-rw-r--r--gsl-1.9/rng/random.c656
-rw-r--r--gsl-1.9/rng/randu.c95
-rw-r--r--gsl-1.9/rng/ranf.c161
-rw-r--r--gsl-1.9/rng/ranlux.c222
-rw-r--r--gsl-1.9/rng/ranlxd.c249
-rw-r--r--gsl-1.9/rng/ranlxs.c302
-rw-r--r--gsl-1.9/rng/ranmar.c173
-rw-r--r--gsl-1.9/rng/rng.c211
-rw-r--r--gsl-1.9/rng/schrage.c51
-rw-r--r--gsl-1.9/rng/slatec.c205
-rw-r--r--gsl-1.9/rng/taus.c184
-rw-r--r--gsl-1.9/rng/taus113.c168
-rw-r--r--gsl-1.9/rng/test.c602
-rw-r--r--gsl-1.9/rng/transputer.c83
-rw-r--r--gsl-1.9/rng/tt.c143
-rw-r--r--gsl-1.9/rng/types.c101
-rw-r--r--gsl-1.9/rng/uni.c201
-rw-r--r--gsl-1.9/rng/uni32.c203
-rw-r--r--gsl-1.9/rng/vax.c83
-rw-r--r--gsl-1.9/rng/waterman14.c92
-rw-r--r--gsl-1.9/rng/zuf.c141
49 files changed, 8588 insertions, 0 deletions
diff --git a/gsl-1.9/rng/ChangeLog b/gsl-1.9/rng/ChangeLog
new file mode 100644
index 0000000..de53658
--- /dev/null
+++ b/gsl-1.9/rng/ChangeLog
@@ -0,0 +1,377 @@
+2007-01-28 Brian Gough <bjg@network-theory.co.uk>
+
+ * knuthran2002.c: added revised version from 9th printing
+
+2007-01-04 Brian Gough <bjg@network-theory.co.uk>
+
+ * default.c (gsl_rng_env_setup): send newline to stderr not stdout
+
+2006-04-13 Brian Gough <bjg@network-theory.co.uk>
+
+ * default.c (gsl_rng_env_setup): print a newline after list of
+ generators in error message
+
+2006-03-16 Brian Gough <bjg@network-theory.co.uk>
+
+ * test.c (main): added taus2 test
+
+2006-02-19 Brian Gough <bjg@network-theory.co.uk>
+
+ * rng.c: added note about why range=max-min not max-min+1
+
+2005-12-16 Brian Gough <bjg@network-theory.co.uk>
+
+ * rng.c (gsl_rng_uniform_int): catch the case n = 0 and return an
+ error
+
+2003-07-23 Brian Gough <bjg@network-theory.co.uk>
+
+ * file.c: added fwrite/fread functions
+
+2003-06-12 Brian Gough <bjg@network-theory.co.uk>
+
+ * Makefile.am: removed benchmark programs from default build
+
+2003-06-02 Brian Gough <bjg@network-theory.co.uk>
+
+ * waterman14.c: increased RAND_MIN to 1
+
+ * lecuyer21.c: corrections to RAND_MIN, RAND_MAX, floating point
+ denominator and seeding modulus
+
+ * fishman20.c (ran_get): use schrage multiplication to avoid
+ overflow
+
+ * coveyou.c: corrected value of RAND_MIN to 1 and RAND_MAX to 2^32-1
+
+ * borosh13.c: increased RAND_MIN to 1
+
+ * knuthran2.c (ran_get): use schrage multiplication to avoid
+ overflow in intermediate results
+
+ * fishman2x.c (ran_get): use schrage multiplication to avoid
+ overflow in intermediate results
+
+ * fishman18.c (ran_get): use schrage multiplication to avoid
+ overflow in intermediate results
+
+ * schrage.c (schrage): utility functions for multiplication of
+ long integers
+
+ * test.c (main): updated incorrect test values for
+ gsl_rng_fishman18 gsl_rng_fishman2x gsl_rng_knuthran2
+
+Mon Nov 25 19:27:10 2002 Brian Gough <bjg@network-theory.co.uk>
+
+ * taus.c (taus2_set): fixed bug in seeding for s3 (test should be
+ for s3<16, not s3<8)
+
+Sun Nov 3 14:40:43 2002 Brian Gough <bjg@network-theory.co.uk>
+
+ * taus.c (taus2_set): fixed bug in seeding for s2 < 8
+
+Mon Jun 17 21:04:10 2002 Brian Gough <bjg@network-theory.co.uk>
+
+ * mt.c (mt_set): ensure state counter mti is initialised by
+ seeding routine
+
+Wed May 29 21:52:11 2002 Brian Gough <bjg@network-theory.co.uk>
+
+ * randu.c: removed unused variable m
+
+Tue May 7 22:34:52 2002 Brian Gough <bjg@network-theory.co.uk>
+
+ * mt.c (mt_1999_set): updated seeding procedure according to new
+ release of MT19937 from the original authors.
+
+Fri Apr 26 21:17:05 2002 Brian Gough <bjg@network-theory.co.uk>
+
+ * taus.c (taus2_set): added alternate seeding procedure as
+ described in erratum to P.L'Ecuyer's paper.
+
+Wed Apr 17 19:37:49 2002 Brian Gough <bjg@network-theory.co.uk>
+
+ * test.c (main): added missing test for gsl_rng_mt19937_1998
+
+ * gsl_rng.h: added missing declaration for gsl_rng_mt19937_1998
+
+Sun Dec 2 15:45:24 2001 Brian Gough <bjg@network-theory.co.uk>
+
+ * Added new generators borosh13, coveyou, fishman18, fishman20,
+ fishman2x, knuthran, knuthran2, lecuyer21, waterman14 from Knuth's
+ Seminumerical Algorithms 3rd Ed. Implemented by Carlo Perassi.
+
+ * gfsr4.c (gfsr4_get_double): increased divisor for double to
+ 2^32, avoids generating exact result of 1.0 as specified in the
+ documentation
+
+Mon Sep 3 10:32:01 2001 Brian Gough <bjg@network-theory.co.uk>
+
+ * mt.c (mt_1998_set): renamed macro to avoid duplicate definition
+
+Fri Aug 31 17:49:37 2001 Brian Gough <bjg@network-theory.co.uk>
+
+ * mt.c (mt_1998_set): added the original (buggy) MT19937 seeding
+ routine as mt19937_1998 for compatibility.
+
+Wed May 2 15:35:38 2001 Brian Gough <bjg@network-theory.co.uk>
+
+ * ran1.c (ran1_get_double): use float constants for comparison
+ for compatibility with original Numerical Recipes routines
+
+ * ran2.c (ran2_get_double): ditto
+
+Fri Apr 27 18:47:07 2001 Brian Gough <bjg@network-theory.co.uk>
+
+ * types.c (gsl_rng_types_setup): added void to make prototype
+ valid in ansi c
+
+Mon Apr 16 20:03:07 2001 Brian Gough <bjg@network-theory.co.uk>
+
+ * default.c (gsl_rng_env_setup): removed spurious argument to
+ fprintf
+
+Tue Jan 23 13:24:26 2001 Brian Gough <bjg@network-theory.co.uk>
+
+ * types.c (gsl_rng_types_setup): provide a function that returns a
+ list of all the generator types
+
+ * default.c (gsl_rng_env_setup): get the list of generators from a
+ function rather than having a list in the code itself. Display a
+ list of the valid generators if the user provides an incorrect one.
+
+Fri Dec 8 20:30:58 2000 Brian Gough <bjg@network-theory.co.uk>
+
+ * ranlxs.c: renamed internal function ranlxs_set_impl to
+ ranlxs_set
+
+ * ranlxd.c: renamed internal function ranlxd_set_impl to
+ ranlxd_set
+
+ * ranlux.c: renamed internal function ranlux_set_impl to
+ ranlux_set
+
+ * random.c: renamed internal function random_get_impl function to
+ random_get
+
+Sat Jul 29 14:29:54 2000 Brian Gough <bjg@network-theory.co.uk>
+
+ * test.c (main): updated test value for MT19937 for new seeding
+ procedure
+
+ * mt.c: The seeding procedure has been updated to match the 10/99
+ release of MT19937.
+
+Wed Mar 8 16:04:34 2000 Brian Gough <bjg@network-theory.co.uk>
+
+ * rng.c (gsl_rng_memcpy): generators must now be of the same type
+ for a copy from one to the other to work.
+
+Thu Feb 24 16:41:48 2000 Brian Gough <bjg@network-theory.co.uk>
+
+ * ran3.c (ran3_set): initialize unused zeroth element of state to
+ zero for consistency.
+
+Mon Feb 14 13:28:26 2000 Brian Gough <bjg@network-theory.co.uk>
+
+ * made all internal functions static
+
+Mon Dec 6 16:21:05 1999 Brian Gough <bjg@network-theory.co.uk>
+
+ * test.c (main): rewrote the tests to loop over all the generators
+
+Wed Aug 11 20:57:10 1999 Brian Gough <bjg@network-theory.co.uk>
+
+ * ranlxd.c, ranlxs.c: added ranlxd and ranlxs, second generation
+ RANLUX generators from Martin Luescher.
+
+Mon Mar 1 21:12:28 1999 Brian Gough <bjg@netsci.freeserve.co.uk>
+
+ * test.c (rng_parallel_state_test): added some extra tests to fill
+ a few holes in the net
+
+ * gsl_rng.h: moved static class information (max, min, etc) out of
+ the instance data. Originally I avoided this because of the
+ overhead of the extra indirection (r->type->get vs r->get) for
+ every get function call, but that turns out to be only about 10%
+ at worst so it's worth the slight speed cost to make the code
+ safer.
+
+Tue Nov 17 17:09:31 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * gfsr4.c: added #include <config.h> which was missing
+
+1998-11-04 <bjg@ancho.lanl.gov>
+
+ * ranf.c: fix portability problems on alpha, by ensuring that
+ shorts are correctly promoted to longs at the appropriate points
+
+ * rand48.c: fix portability problems by ensuring that shorts are
+ correctly promoted to longs at the appropriate points
+
+ * rng-dump.c (main): write out file correctly by using chars
+ instead of unsigned long ints, since these can vary in size on
+ different architectures
+
+Wed Oct 28 15:02:22 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * rng.c: added #include <string.h> to get prototype for memcpy
+
+Mon Sep 14 20:53:09 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * default.c (gsl_rng_env_setup): added gfsr4
+
+1998-09-10 James Theiler <jt@lanl.gov>
+
+ * gfsr4.c: added new random number generator
+
+ * Makefile.am: added gfsr4.c to SOURCES list
+
+ * gsl_rng.h: added gfsr4
+
+ * test.c: added gfsr4
+
+ * benchmark.c: added gfsr4
+
+Mon Aug 10 22:12:13 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * rng-dump.c: program to write out 3 million random numbers,
+ suitable for testing with DIEHARD.
+
+Tue Aug 4 19:51:57 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * default.c (gsl_rng_env_setup): send default/enviroment output to
+ stderr
+
+Mon Aug 3 18:25:52 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * mt.c: made constants static since they shouldn't be exported,
+ added some speed improvements from Cokus' code (not all of them
+ since they seemed to use more registers than available on the
+ pentium).
+
+Thu Jul 9 13:56:20 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * slatec.c: renamed cmlib.c to slatec.c
+
+ * transputer.c: renamed tds.c to transputer.c so the name is a bit
+ more obvious
+
+ * random.c: renamed random0 functions to random8, since obviously
+ we can't have 0 bytes of state
+
+ * default.c (gsl_rng_env_setup): made gsl_rng_mt19937 the default
+ generator
+
+Wed Jul 8 17:06:54 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * added random() functions. There are three(!) versions: the
+ original BSD, linux libc5 (had a typo in the multiplier, but got
+ installed on millions of machines so is now a defacto standard)
+ and GNU glibc2 (fixes the typo and has an improved seeding
+ procedure)
+
+Sun Jul 5 15:59:29 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * rand.c: renamed rand.c to cmlib.c and bsdrand.c to rand.c.
+
+ * ranf.c: added CRAY RANF, 48 bit generator
+
+ * rand48.c: added the standard unix rand48()
+
+ * changed all the routines to allow an additional callback for
+ returning doubles. Now we can implement numerical recipes with its
+ non-standard checks on the floating point results and also access
+ the full state for getting 48-bit doubles out of rand48.
+
+Sat Jul 4 11:14:49 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * ranmar.c: added the RANMAR generator
+
+ * tds.c: added the INMOS Transputer RNG
+
+ * test.c (rng_min_test): added a test for RAND_MIN, to make sure
+ none of the generators go below it. Statistically the test is not
+ much good since it's very unlikely that an off-by-one error would
+ show up unless we ran the test for > 4 billion numbers. However,
+ the test might detect a gross error like a typo in RAND_MIN or a
+ degeneracy 0,0,0,... for a multiplicative generator.
+
+ * uni.c: fixed RAND_MAX here too
+
+ * uni32.c: fixed RAND_MAX to m1-1, not m1 (since it's modulo m1 so
+ m1 can't occur, only m1-1)
+
+Fri Jul 3 15:55:34 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * rng.c (gsl_rng_uniform_gt0_lt1): added a function which returns
+ numbers in the range (0,1), i.e. excluding 0.0 and 1.0
+
+ * renamed bad_randu.c to randu.c
+
+ * renamed bad_rand.c to bsdrand.c
+
+Mon Jun 29 18:11:08 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * added implementations of the numerical recipes algorithms ran0,
+ ran1, ran2, ran3
+
+Sun Jun 28 11:51:48 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * gsl_rng.h: added gsl_rng_uniform_pos which guarantees positive
+ numbers, (0,1]
+
+ * added a RAND_MIN entry to the gsl_rng/gsl_rng_type structs
+
+ * gsl_rng.h: renamed gsl_rng_get_uni to gsl_rng_uniform
+
+Wed Jun 24 12:10:23 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * gsl_rng.h: added inline versions of gsl_rng_get and
+ gsl_rng_get_uni
+
+ * benchmark.c: added a simple benchmark program to measure rng's
+ per second
+
+ * test.c (N2): reduced the number of tests from 1 million to 100k
+ to speed things up a bit
+
+ * changed the generic seeding algorithm to s -> (69069*s) &
+ 0xFFFFFFFF which covers all 32 bits.
+
+Sun Jun 21 23:24:36 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * added the MT19937 and TT880 mersenne prime generators
+
+Sat Jun 20 13:58:40 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * ensured that 32 bit quantities are defined as 'long', as
+ required by ANSI. On a 16 bit platform 'int' is usually just 16
+ bits.
+
+ * ranlux.c: added the RANLUX generator
+
+Fri Jun 19 11:12:06 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * removed the gsl- prefix from generator name strings
+
+Thu Jun 18 12:17:16 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * test.c: added a 10000 iteration check for cmrg
+
+ * got rid of init_state values. It's simpler to generate them
+ directly from the seed, the cost of creating an rng is not usually
+ a big deal.
+
+ * rng.c: eliminated the gsl_rng_internal struct since it was not
+ really necessary
+
+Wed Jun 17 17:31:27 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * minstd.c: added Park and Millers MINSTD generator
+
+Thu Jun 11 18:08:40 1998 Brian Gough <bjg@vvv.lanl.gov>
+
+ * this will be an alternate, thread-safe interface to the random
+ number generators.
+
diff --git a/gsl-1.9/rng/Makefile.am b/gsl-1.9/rng/Makefile.am
new file mode 100644
index 0000000..5c6e528
--- /dev/null
+++ b/gsl-1.9/rng/Makefile.am
@@ -0,0 +1,22 @@
+noinst_LTLIBRARIES = libgslrng.la
+
+pkginclude_HEADERS = gsl_rng.h
+
+INCLUDES= -I$(top_builddir)
+
+libgslrng_la_SOURCES = borosh13.c cmrg.c coveyou.c default.c file.c fishman18.c fishman20.c fishman2x.c gfsr4.c knuthran2.c knuthran.c knuthran2002.c lecuyer21.c minstd.c mrg.c mt.c r250.c ran0.c ran1.c ran2.c ran3.c rand48.c rand.c random.c randu.c ranf.c ranlux.c ranlxd.c ranlxs.c ranmar.c rng.c slatec.c taus.c taus113.c transputer.c tt.c types.c uni32.c uni.c vax.c waterman14.c zuf.c
+
+CLEANFILES = test.dat
+
+noinst_HEADERS = schrage.c
+
+test_SOURCES = test.c
+test_LDADD = libgslrng.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+
+TESTS = $(check_PROGRAMS)
+check_PROGRAMS = test
+
+# benchmark_SOURCES = benchmark.c
+# benchmark_LDADD = libgslrng.la ../err/libgslerr.la ../utils/libutils.la
+# rng_dump_SOURCES = rng-dump.c
+# rng_dump_LDADD = libgslrng.la ../err/libgslerr.la ../utils/libutils.la
diff --git a/gsl-1.9/rng/Makefile.in b/gsl-1.9/rng/Makefile.in
new file mode 100644
index 0000000..5f4851e
--- /dev/null
+++ b/gsl-1.9/rng/Makefile.in
@@ -0,0 +1,558 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+check_PROGRAMS = test$(EXEEXT)
+subdir = rng
+DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog TODO
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libgslrng_la_LIBADD =
+am_libgslrng_la_OBJECTS = borosh13.lo cmrg.lo coveyou.lo default.lo \
+ file.lo fishman18.lo fishman20.lo fishman2x.lo gfsr4.lo \
+ knuthran2.lo knuthran.lo knuthran2002.lo lecuyer21.lo \
+ minstd.lo mrg.lo mt.lo r250.lo ran0.lo ran1.lo ran2.lo ran3.lo \
+ rand48.lo rand.lo random.lo randu.lo ranf.lo ranlux.lo \
+ ranlxd.lo ranlxs.lo ranmar.lo rng.lo slatec.lo taus.lo \
+ taus113.lo transputer.lo tt.lo types.lo uni32.lo uni.lo vax.lo \
+ waterman14.lo zuf.lo
+libgslrng_la_OBJECTS = $(am_libgslrng_la_OBJECTS)
+am_test_OBJECTS = test.$(OBJEXT)
+test_OBJECTS = $(am_test_OBJECTS)
+test_DEPENDENCIES = libgslrng.la ../ieee-utils/libgslieeeutils.la \
+ ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la \
+ ../utils/libutils.la
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgslrng_la_SOURCES) $(test_SOURCES)
+DIST_SOURCES = $(libgslrng_la_SOURCES) $(test_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(pkgincludedir)"
+pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(noinst_HEADERS) $(pkginclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GSL_CFLAGS = @GSL_CFLAGS@
+GSL_LIBS = @GSL_LIBS@
+GSL_LT_CBLAS_VERSION = @GSL_LT_CBLAS_VERSION@
+GSL_LT_VERSION = @GSL_LT_VERSION@
+HAVE_AIX_IEEE_INTERFACE = @HAVE_AIX_IEEE_INTERFACE@
+HAVE_DARWIN86_IEEE_INTERFACE = @HAVE_DARWIN86_IEEE_INTERFACE@
+HAVE_DARWIN_IEEE_INTERFACE = @HAVE_DARWIN_IEEE_INTERFACE@
+HAVE_EXTENDED_PRECISION_REGISTERS = @HAVE_EXTENDED_PRECISION_REGISTERS@
+HAVE_FREEBSD_IEEE_INTERFACE = @HAVE_FREEBSD_IEEE_INTERFACE@
+HAVE_GNUM68K_IEEE_INTERFACE = @HAVE_GNUM68K_IEEE_INTERFACE@
+HAVE_GNUPPC_IEEE_INTERFACE = @HAVE_GNUPPC_IEEE_INTERFACE@
+HAVE_GNUSPARC_IEEE_INTERFACE = @HAVE_GNUSPARC_IEEE_INTERFACE@
+HAVE_GNUX86_IEEE_INTERFACE = @HAVE_GNUX86_IEEE_INTERFACE@
+HAVE_HPUX11_IEEE_INTERFACE = @HAVE_HPUX11_IEEE_INTERFACE@
+HAVE_HPUX_IEEE_INTERFACE = @HAVE_HPUX_IEEE_INTERFACE@
+HAVE_IEEE_COMPARISONS = @HAVE_IEEE_COMPARISONS@
+HAVE_IEEE_DENORMALS = @HAVE_IEEE_DENORMALS@
+HAVE_INLINE = @HAVE_INLINE@
+HAVE_IRIX_IEEE_INTERFACE = @HAVE_IRIX_IEEE_INTERFACE@
+HAVE_NETBSD_IEEE_INTERFACE = @HAVE_NETBSD_IEEE_INTERFACE@
+HAVE_OPENBSD_IEEE_INTERFACE = @HAVE_OPENBSD_IEEE_INTERFACE@
+HAVE_OS2EMX_IEEE_INTERFACE = @HAVE_OS2EMX_IEEE_INTERFACE@
+HAVE_PRINTF_LONGDOUBLE = @HAVE_PRINTF_LONGDOUBLE@
+HAVE_SOLARIS_IEEE_INTERFACE = @HAVE_SOLARIS_IEEE_INTERFACE@
+HAVE_SUNOS4_IEEE_INTERFACE = @HAVE_SUNOS4_IEEE_INTERFACE@
+HAVE_TRU64_IEEE_INTERFACE = @HAVE_TRU64_IEEE_INTERFACE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+RELEASED = @RELEASED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+noinst_LTLIBRARIES = libgslrng.la
+pkginclude_HEADERS = gsl_rng.h
+INCLUDES = -I$(top_builddir)
+libgslrng_la_SOURCES = borosh13.c cmrg.c coveyou.c default.c file.c fishman18.c fishman20.c fishman2x.c gfsr4.c knuthran2.c knuthran.c knuthran2002.c lecuyer21.c minstd.c mrg.c mt.c r250.c ran0.c ran1.c ran2.c ran3.c rand48.c rand.c random.c randu.c ranf.c ranlux.c ranlxd.c ranlxs.c ranmar.c rng.c slatec.c taus.c taus113.c transputer.c tt.c types.c uni32.c uni.c vax.c waterman14.c zuf.c
+CLEANFILES = test.dat
+noinst_HEADERS = schrage.c
+test_SOURCES = test.c
+test_LDADD = libgslrng.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+TESTS = $(check_PROGRAMS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps rng/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps rng/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libgslrng.la: $(libgslrng_la_OBJECTS) $(libgslrng_la_DEPENDENCIES)
+ $(LINK) $(libgslrng_la_LDFLAGS) $(libgslrng_la_OBJECTS) $(libgslrng_la_LIBADD) $(LIBS)
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES)
+ @rm -f test$(EXEEXT)
+ $(LINK) $(test_LDFLAGS) $(test_OBJECTS) $(test_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.c.o:
+ $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+install-pkgincludeHEADERS: $(pkginclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkgincludedir)" || $(mkdir_p) "$(DESTDIR)$(pkgincludedir)"
+ @list='$(pkginclude_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \
+ $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \
+ done
+
+uninstall-pkgincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkginclude_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list='$(TESTS)'; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *" $$tst "*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *" $$tst "*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(pkgincludedir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ clean-noinstLTLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pkgincludeHEADERS
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-pkgincludeHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool \
+ clean-noinstLTLIBRARIES ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man \
+ install-pkgincludeHEADERS install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-pkgincludeHEADERS
+
+
+# benchmark_SOURCES = benchmark.c
+# benchmark_LDADD = libgslrng.la ../err/libgslerr.la ../utils/libutils.la
+# rng_dump_SOURCES = rng-dump.c
+# rng_dump_LDADD = libgslrng.la ../err/libgslerr.la ../utils/libutils.la
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/gsl-1.9/rng/TODO b/gsl-1.9/rng/TODO
new file mode 100644
index 0000000..4967b04
--- /dev/null
+++ b/gsl-1.9/rng/TODO
@@ -0,0 +1,97 @@
+* gfsr: for consistency (Charles A. Wemple). Make this change in 2.0
+
+ 127a142
+> state->nd = i-1;
+133,134c148,149
+< for (i=0; i<32; ++i) {
+< int k=7+i*3;
+---
+> for (i=0; i<32; i++) {
+> int k=7*i+3;
+141d155
+< state->nd = i;
+
+
+* Sort out "const" in prototypes, it looks odd since there are consts
+for many functions which modify the state. (Applies to both qrng and rng)
+
+* New 64 bit generators in "Tables of 64-bit Mersenne Twisters",
+Takuji Nishimura, ACM Transactions on Modeling and Computer
+Simulation, Volumen 10, No 4, October 2000, p 348--357
+
+* Need to run tests over the space of seeds, in addition to serial
+tests (DIEHARD) for the default seed. The congruences used for
+seeding will give poor initial vectors for some seed values, e.g. 2^n.
+Improve the seeding procedure by using a high-quality generator
+(e.g. hash functions, md5 or sha) to generate the initial vectors.
+Even if this is moderately expensive it is worthwhile since the
+seeding is usually a one-off cost at program initialization, and the
+results of all subsequent calls to the generator depend on it. The
+GSFR4 generator is particularly likely to benefit from this procedure.
+
+* Add SWNS generator Phys.Rev.E 50 (2) p. 1607-1615 (1994), Phys.Rev.E
+60 (6), p.7626-7628 (1999)
+
+* Add get_array type methods which can provide optimized versions of
+each function (?). We should offer the possibility of eliminating
+function call overhead -- there are various possible ways to implement
+it.
+
+* Add ISAAC generator (??)
+
+* Add (A)RC4 and hash based random number generators MD5, SHA. This
+should give crypto quality randomness, and guarantee different
+sequences for each seed. Make the state (seed, count) where count
+increments on each call of the generator. Implement count as a big
+integer stored in separate unsigned integers so that the period is
+sufficiently long (e.g. 2^64 or 2^96). The generator would return
+HASH(seed, count) on each call.
+
+* Check that RANLXS will work on machines with non-standard width of
+float/dbl (original has checks for DBL_MANT_DIG ..)
+
+* mention more clearly why not all Cokus used (or recheck MT pages for
+improvements)
+
+* run the DIEHARD tests on all the generators, especially the ones we
+are listing as "Simulation Quality" -- some of those are a bit old and
+might fail one or two diehard tests.
+
+* Add NAG, missing, gave up!
+ CDC 48-bit missing
+
+* Check out the bug fix to mrand48 that was made in glibc2, pr757
+
+* Check out the following paper,
+
+ On the anomaly of ran1() in Monte Carlo pricing of financial
+ derivatives; Akira Tajima , Syoiti Ninomiya , and Shu Tezuka ; Winter
+ simulation , 1996, Page 360, from ACM
+
+* The following papers have been published, I think we refer to them
+(or could do),
+
+ Pierre L'Ecuyer, "Tables of Linear Congruential Generators of different
+ size and good lattice structure", Mathematics of Computation, Vol 68,
+ No 225, Jan 1999, p249-260
+
+ Pierre L'Ecuyer, "Tables of Maximally equidistributed combined LSFR
+ generators", ibid, p261-270
+
+* Look at this paper: I. Vattulainen, "Framework for testing random numbers
+ in parallel calculations", Phys. Rev. E, 59, 6, June 1999, p7200
+
+----------------------------------------------------------------------
+DONE
+
+x1. Improve the seeding for routines that use the LCG seed generator.
+It can only generate 130,000 different initial states. We should
+change it to provide 2^31 different initial states (this will also
+prevent the high bits being zero). DONE - we now use a 32-bit
+generator.
+
+x8. Get the macros from the faster MT19937 generator and use them. We
+need to make MT be the fastest of the simulation quality generators if
+it is the default. DONE. It didn't improve the speed on other
+platforms, so I just used the tricks which also worked on the pentium
+(e.g. changing mag[x&1] to x&1 ? mag[1] : mag[0])
diff --git a/gsl-1.9/rng/borosh13.c b/gsl-1.9/rng/borosh13.c
new file mode 100644
index 0000000..d0957f8
--- /dev/null
+++ b/gsl-1.9/rng/borosh13.c
@@ -0,0 +1,92 @@
+/* rng/borosh13.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * This generator is taken from
+ *
+ * Donald E. Knuth
+ * The Art of Computer Programming
+ * Volume 2
+ * Third Edition
+ * Addison-Wesley
+ * Page 106-108
+ *
+ * It is called "Borosh - Niederreiter"
+ *
+ * This implementation copyright (C) 2001 Carlo Perassi and
+ * (C) 2003 Heiko Bauke.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+#define AA 1812433253UL
+#define MM 0xffffffffUL /* 2 ^ 32 - 1 */
+
+static inline unsigned long int ran_get (void *vstate);
+static double ran_get_double (void *vstate);
+static void ran_set (void *state, unsigned long int s);
+
+typedef struct
+{
+ unsigned long int x;
+}
+ran_state_t;
+
+static inline unsigned long int
+ran_get (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ state->x = (AA * state->x) & MM;
+
+ return state->x;
+}
+
+static double
+ran_get_double (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ return ran_get (state) / 4294967296.0;
+}
+
+static void
+ran_set (void *vstate, unsigned long int s)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ if (s == 0)
+ s = 1; /* default seed is 1 */
+
+ state->x = s & MM;
+
+ return;
+}
+
+static const gsl_rng_type ran_type = {
+ "borosh13", /* name */
+ MM, /* RAND_MAX */
+ 1, /* RAND_MIN */
+ sizeof (ran_state_t),
+ &ran_set,
+ &ran_get,
+ &ran_get_double
+};
+
+const gsl_rng_type *gsl_rng_borosh13 = &ran_type;
diff --git a/gsl-1.9/rng/cmrg.c b/gsl-1.9/rng/cmrg.c
new file mode 100644
index 0000000..60cca64
--- /dev/null
+++ b/gsl-1.9/rng/cmrg.c
@@ -0,0 +1,197 @@
+/* rng/cmrg.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is a combined multiple recursive generator. The sequence is,
+
+ z_n = (x_n - y_n) mod m1
+
+ where the two underlying generators x and y are,
+
+ x_n = (a_{1} x_{n-1} + a_{2} x_{n-2} + a_{3} x_{n-3}) mod m1
+ y_n = (b_{1} y_{n-1} + b_{2} y_{n-2} + b_{3} y_{n-3}) mod m2
+
+ with coefficients a11 ... a23,
+
+ a_{1} = 0, a_{2} = 63308, a_{3} = -183326
+ b_{1} = 86098, b_{2} = 0, b_{3} = -539608
+
+ and moduli m1, m2,
+
+ m1 = 2^31 - 1 = 2147483647
+ m2 = 2^31 - 2000169 = 2145483479
+
+ We initialize the generator with
+
+ x_1 = s_1 MOD m1, x_2 = s_2 MOD m1, x_3 = s_3 MOD m1
+ y_1 = s_4 MOD m2, y_2 = s_5 MOD m2, y_3 = s_6 MOD m2
+
+ where s_n = (69069 * s_{n-1}) mod 2^32 and s_0 = s is the
+ user-supplied seed.
+
+ NOTE: According to the paper the initial values for x_n must lie in
+ the range 0 <= x_n <= (m1 - 1) and the initial values for y_n must
+ lie in the range 0 <= y_n <= (m2 - 1), with at least one non-zero
+ value -- our seeding procedure satisfies these constraints.
+
+ We then use 7 iterations of the generator to "warm up" the internal
+ state.
+
+ The theoretical value of z_{10008} is 719452880. The subscript 10008
+ means (1) seed the generator with s=1, (2) do the seven warm-up
+ iterations that are part of the seeding process, (3) then do 10000
+ actual iterations.
+
+ The period of this generator is about 2^205.
+
+ From: P. L'Ecuyer, "Combined Multiple Recursive Random Number
+ Generators," Operations Research, 44, 5 (1996), 816--822.
+
+ This is available on the net from L'Ecuyer's home page,
+
+ http://www.iro.umontreal.ca/~lecuyer/myftp/papers/combmrg.ps
+ ftp://ftp.iro.umontreal.ca/pub/simulation/lecuyer/papers/combmrg.ps */
+
+static inline unsigned long int cmrg_get (void *vstate);
+static double cmrg_get_double (void *vstate);
+static void cmrg_set (void *state, unsigned long int s);
+
+static const long int m1 = 2147483647, m2 = 2145483479;
+
+static const long int a2 = 63308, qa2 = 33921, ra2 = 12979;
+static const long int a3 = -183326, qa3 = 11714, ra3 = 2883;
+static const long int b1 = 86098, qb1 = 24919, rb1 = 7417;
+static const long int b3 = -539608, qb3 = 3976, rb3 = 2071;
+
+typedef struct
+ {
+ long int x1, x2, x3; /* first component */
+ long int y1, y2, y3; /* second component */
+ }
+cmrg_state_t;
+
+static inline unsigned long int
+cmrg_get (void *vstate)
+{
+ cmrg_state_t *state = (cmrg_state_t *) vstate;
+
+ /* Component 1 */
+
+ {
+ long int h3 = state->x3 / qa3;
+ long int p3 = -a3 * (state->x3 - h3 * qa3) - h3 * ra3;
+
+ long int h2 = state->x2 / qa2;
+ long int p2 = a2 * (state->x2 - h2 * qa2) - h2 * ra2;
+
+ if (p3 < 0)
+ p3 += m1;
+ if (p2 < 0)
+ p2 += m1;
+
+ state->x3 = state->x2;
+ state->x2 = state->x1;
+ state->x1 = p2 - p3;
+ if (state->x1 < 0)
+ state->x1 += m1;
+ }
+
+ /* Component 2 */
+
+ {
+ long int h3 = state->y3 / qb3;
+ long int p3 = -b3 * (state->y3 - h3 * qb3) - h3 * rb3;
+
+ long int h1 = state->y1 / qb1;
+ long int p1 = b1 * (state->y1 - h1 * qb1) - h1 * rb1;
+
+ if (p3 < 0)
+ p3 += m2;
+ if (p1 < 0)
+ p1 += m2;
+
+ state->y3 = state->y2;
+ state->y2 = state->y1;
+ state->y1 = p1 - p3;
+ if (state->y1 < 0)
+ state->y1 += m2;
+ }
+
+ if (state->x1 < state->y1)
+ return (state->x1 - state->y1 + m1);
+ else
+ return (state->x1 - state->y1);
+}
+
+static double
+cmrg_get_double (void *vstate)
+{
+ return cmrg_get (vstate) / 2147483647.0 ;
+}
+
+
+static void
+cmrg_set (void *vstate, unsigned long int s)
+{
+ /* An entirely adhoc way of seeding! This does **not** come from
+ L'Ecuyer et al */
+
+ cmrg_state_t *state = (cmrg_state_t *) vstate;
+
+ if (s == 0)
+ s = 1; /* default seed is 1 */
+
+#define LCG(n) ((69069 * n) & 0xffffffffUL)
+ s = LCG (s);
+ state->x1 = s % m1;
+ s = LCG (s);
+ state->x2 = s % m1;
+ s = LCG (s);
+ state->x3 = s % m1;
+
+ s = LCG (s);
+ state->y1 = s % m2;
+ s = LCG (s);
+ state->y2 = s % m2;
+ s = LCG (s);
+ state->y3 = s % m2;
+
+ /* "warm it up" */
+ cmrg_get (state);
+ cmrg_get (state);
+ cmrg_get (state);
+ cmrg_get (state);
+ cmrg_get (state);
+ cmrg_get (state);
+ cmrg_get (state);
+}
+
+static const gsl_rng_type cmrg_type =
+{"cmrg", /* name */
+ 2147483646, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (cmrg_state_t),
+ &cmrg_set,
+ &cmrg_get,
+ &cmrg_get_double};
+
+const gsl_rng_type *gsl_rng_cmrg = &cmrg_type;
diff --git a/gsl-1.9/rng/coveyou.c b/gsl-1.9/rng/coveyou.c
new file mode 100644
index 0000000..8732990
--- /dev/null
+++ b/gsl-1.9/rng/coveyou.c
@@ -0,0 +1,92 @@
+/* rng/coveyou.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * This generator is taken from
+ *
+ * Donald E. Knuth
+ * The Art of Computer Programming
+ * Volume 2
+ * Third Edition
+ * Addison-Wesley
+ * Section 3.2.2
+ *
+ * This implementation copyright (C) 2001 Carlo Perassi
+ * and (C) 2003 Heiko Bauke.
+ * Carlo Perassi reorganized the code to use the rng framework of GSL.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+#define MM 0xffffffffUL /* 2 ^ 32 - 1 */
+
+static inline unsigned long int ran_get (void *vstate);
+static double ran_get_double (void *vstate);
+static void ran_set (void *state, unsigned long int s);
+
+typedef struct
+{
+ unsigned long int x;
+}
+ran_state_t;
+
+static inline unsigned long int
+ran_get (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ state->x = (state->x * (state->x + 1)) & MM;
+
+ return state->x;
+}
+
+static double
+ran_get_double (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ return ran_get (state) / 4294967296.0;
+}
+
+static void
+ran_set (void *vstate, unsigned long int s)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ unsigned long int diff = ((s % 4UL) - 2UL) % MM;
+
+ if (diff)
+ state->x = (s - diff) & MM;
+ else
+ state->x = s & MM;
+
+ return;
+}
+
+static const gsl_rng_type ran_type = {
+ "coveyou", /* name */
+ MM-1, /* RAND_MAX */
+ 2, /* RAND_MIN */
+ sizeof (ran_state_t),
+ &ran_set,
+ &ran_get,
+ &ran_get_double
+};
+
+const gsl_rng_type *gsl_rng_coveyou = &ran_type;
diff --git a/gsl-1.9/rng/default.c b/gsl-1.9/rng/default.c
new file mode 100644
index 0000000..1da0e8a
--- /dev/null
+++ b/gsl-1.9/rng/default.c
@@ -0,0 +1,93 @@
+/* rng/default.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <gsl/gsl_rng.h>
+#include <gsl/gsl_errno.h>
+
+/* The initial defaults are defined in the file mt.c, so we can get
+ access to the static parts of the default generator. */
+
+const gsl_rng_type *
+gsl_rng_env_setup (void)
+{
+ unsigned long int seed = 0;
+ const char *p = getenv ("GSL_RNG_TYPE");
+
+ if (p)
+ {
+ const gsl_rng_type **t, **t0 = gsl_rng_types_setup ();
+
+ gsl_rng_default = 0;
+
+ /* check GSL_RNG_TYPE against the names of all the generators */
+
+ for (t = t0; *t != 0; t++)
+ {
+ if (strcmp (p, (*t)->name) == 0)
+ {
+ gsl_rng_default = *t;
+ break;
+ }
+ }
+
+ if (gsl_rng_default == 0)
+ {
+ int i = 0;
+
+ fprintf (stderr, "GSL_RNG_TYPE=%s not recognized\n", p);
+ fprintf (stderr, "Valid generator types are:\n");
+
+ for (t = t0; *t != 0; t++)
+ {
+ fprintf (stderr, " %18s", (*t)->name);
+
+ if ((++i) % 4 == 0)
+ {
+ fputc ('\n', stderr);
+ }
+ }
+
+ fputc ('\n', stderr);
+
+ GSL_ERROR_VAL ("unknown generator", GSL_EINVAL, 0);
+ }
+
+ fprintf (stderr, "GSL_RNG_TYPE=%s\n", gsl_rng_default->name);
+ }
+ else
+ {
+ gsl_rng_default = gsl_rng_mt19937;
+ }
+
+ p = getenv ("GSL_RNG_SEED");
+
+ if (p)
+ {
+ seed = strtoul (p, 0, 0);
+ fprintf (stderr, "GSL_RNG_SEED=%lu\n", seed);
+ };
+
+ gsl_rng_default_seed = seed;
+
+ return gsl_rng_default;
+}
diff --git a/gsl-1.9/rng/file.c b/gsl-1.9/rng/file.c
new file mode 100644
index 0000000..a18797d
--- /dev/null
+++ b/gsl-1.9/rng/file.c
@@ -0,0 +1,57 @@
+/* rng/file.c
+ *
+ * Copyright (C) 2003 Olaf Lenz
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdio.h>
+#include <gsl/gsl_errno.h>
+#include <gsl/gsl_rng.h>
+
+int
+gsl_rng_fread (FILE * stream, gsl_rng * r)
+{
+ size_t n = r->type->size ;
+
+ char * state = r->state;
+
+ size_t items = fread (state, 1, n, stream);
+
+ if (items != n)
+ {
+ GSL_ERROR ("fread failed", GSL_EFAILED);
+ }
+
+ return GSL_SUCCESS;
+}
+
+int
+gsl_rng_fwrite (FILE * stream, const gsl_rng * r)
+{
+ size_t n = r->type->size ;
+
+ char * state = r->state;
+
+ size_t items = fwrite (state, 1, n, stream);
+
+ if (items != n)
+ {
+ GSL_ERROR ("fwrite failed", GSL_EFAILED);
+ }
+
+ return GSL_SUCCESS;
+}
diff --git a/gsl-1.9/rng/fishman18.c b/gsl-1.9/rng/fishman18.c
new file mode 100644
index 0000000..e57406f
--- /dev/null
+++ b/gsl-1.9/rng/fishman18.c
@@ -0,0 +1,95 @@
+/* rng/fishman18.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * This generator is taken from
+ *
+ * Donald E. Knuth
+ * The Art of Computer Programming
+ * Volume 2
+ * Third Edition
+ * Addison-Wesley
+ * Page 106-108
+ *
+ * It is called "Fishman - Moore III".
+ *
+ * This implementation copyright (C) 2001 Carlo Perassi
+ * and (C) 2003 Heiko Bauke.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+#include "schrage.c"
+
+#define AA 62089911UL
+#define MM 0x7fffffffUL /* 2 ^ 31 - 1 */
+#define CEIL_SQRT_MM 46341UL /* ceil(sqrt(2 ^ 31 - 1)) */
+
+static inline unsigned long int ran_get (void *vstate);
+static double ran_get_double (void *vstate);
+static void ran_set (void *state, unsigned long int s);
+
+typedef struct
+{
+ unsigned long int x;
+}
+ran_state_t;
+
+static inline unsigned long int
+ran_get (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ state->x = schrage_mult (AA, state->x, MM, CEIL_SQRT_MM);
+
+ return state->x;
+}
+
+static double
+ran_get_double (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ return ran_get (state) / 2147483647.0;
+}
+
+static void
+ran_set (void *vstate, unsigned long int s)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ if ((s % MM) == 0)
+ s = 1; /* default seed is 1 */
+
+ state->x = s % MM;
+
+ return;
+}
+
+static const gsl_rng_type ran_type = {
+ "fishman18", /* name */
+ MM - 1, /* RAND_MAX */
+ 1, /* RAND_MIN */
+ sizeof (ran_state_t),
+ &ran_set,
+ &ran_get,
+ &ran_get_double
+};
+
+const gsl_rng_type *gsl_rng_fishman18 = &ran_type;
diff --git a/gsl-1.9/rng/fishman20.c b/gsl-1.9/rng/fishman20.c
new file mode 100644
index 0000000..9851f13
--- /dev/null
+++ b/gsl-1.9/rng/fishman20.c
@@ -0,0 +1,103 @@
+/* rng/fishman20.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * This generator is taken from
+ *
+ * Donald E. Knuth
+ * The Art of Computer Programming
+ * Volume 2
+ * Third Edition
+ * Addison-Wesley
+ * Page 108
+ *
+ * It is called "Fishman"
+ *
+ * This implementation copyright (C) 2001 Carlo Perassi
+ * and (C) 2003 Heiko Bauke.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+static inline unsigned long int ran_get (void *vstate);
+static double ran_get_double (void *vstate);
+static void ran_set (void *state, unsigned long int s);
+
+static const long int m = 2147483647, a = 48271, q = 44488, r = 3399;
+
+typedef struct
+{
+ unsigned long int x;
+}
+ran_state_t;
+
+static inline unsigned long int
+ran_get (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ const unsigned long int x = state->x;
+
+ const long int h = x / q;
+ const long int t = a * (x - h * q) - h * r;
+
+ if (t < 0)
+ {
+ state->x = t + m;
+ }
+ else
+ {
+ state->x = t;
+ }
+
+ return state->x;
+}
+
+static double
+ran_get_double (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ return ran_get (state) / 2147483647.0;
+}
+
+static void
+ran_set (void *vstate, unsigned long int s)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ if ((s%m) == 0)
+ s = 1; /* default seed is 1 */
+
+ state->x = s & m;
+
+ return;
+}
+
+static const gsl_rng_type ran_type = {
+ "fishman20", /* name */
+ 2147483646, /* RAND_MAX */
+ 1, /* RAND_MIN */
+ sizeof (ran_state_t),
+ &ran_set,
+ &ran_get,
+ &ran_get_double
+};
+
+const gsl_rng_type *gsl_rng_fishman20 = &ran_type;
diff --git a/gsl-1.9/rng/fishman2x.c b/gsl-1.9/rng/fishman2x.c
new file mode 100644
index 0000000..afe0c27
--- /dev/null
+++ b/gsl-1.9/rng/fishman2x.c
@@ -0,0 +1,121 @@
+/* rng/fishman2x.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * This generator is taken from
+ *
+ * Donald E. Knuth
+ * The Art of Computer Programming
+ * Volume 2
+ * Third Edition
+ * Addison-Wesley
+ * Page 108
+ *
+ * It is called "Fishman - L'Ecuyer"
+ *
+ * This implementation copyright (C) 2001 Carlo Perassi
+ * and (C) 2003 Heiko Bauke.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* Fishman */
+#define AAA_F 48271UL
+#define MMM_F 0x7fffffffUL /* 2 ^ 31 - 1 */
+#define QQQ_F 44488UL
+#define RRR_F 3399UL
+
+/* L'Ecuyer */
+#define AAA_L 40692UL
+#define MMM_L 0x7fffff07UL /* 2 ^ 31 - 249 */
+#define QQQ_L 52774UL
+#define RRR_L 3791UL
+
+static inline unsigned long int ran_get (void *vstate);
+static double ran_get_double (void *vstate);
+static void ran_set (void *state, unsigned long int s);
+
+typedef struct
+{
+ unsigned long int x;
+ unsigned long int y;
+ unsigned long int z;
+}
+ran_state_t;
+
+static inline unsigned long int
+ran_get (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ long int y, r;
+
+ r = RRR_F * (state->x / QQQ_F);
+ y = AAA_F * (state->x % QQQ_F) - r;
+ if (y < 0)
+ y += MMM_F;
+ state->x = y;
+
+ r = RRR_L * (state->y / QQQ_L);
+ y = AAA_L * (state->y % QQQ_L) - r;
+ if (y < 0)
+ y += MMM_L;
+ state->y = y;
+
+ state->z = (state->x > state->y) ? (state->x - state->y) :
+ MMM_F + state->x - state->y;
+
+ return state->z;
+}
+
+static double
+ran_get_double (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ return ran_get (state) / 2147483647.0;
+}
+
+static void
+ran_set (void *vstate, unsigned long int s)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ if ((s % MMM_F) == 0 || (s % MMM_L) == 0)
+ s = 1; /* default seed is 1 */
+
+ state->x = s % MMM_F;
+ state->y = s % MMM_L;
+ state->z = (state->x > state->y) ? (state->x - state->y) :
+ MMM_F + state->x - state->y;
+
+ return;
+}
+
+static const gsl_rng_type ran_type = {
+ "fishman2x", /* name */
+ MMM_F - 1, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (ran_state_t),
+ &ran_set,
+ &ran_get,
+ &ran_get_double
+};
+
+const gsl_rng_type *gsl_rng_fishman2x = &ran_type;
diff --git a/gsl-1.9/rng/gfsr4.c b/gsl-1.9/rng/gfsr4.c
new file mode 100644
index 0000000..c3bf594
--- /dev/null
+++ b/gsl-1.9/rng/gfsr4.c
@@ -0,0 +1,165 @@
+/* This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details. You should have received
+ a copy of the GNU General Public License along with this program;
+ if not, write to the Free Foundation, Inc., 59 Temple Place, Suite
+ 330, Boston, MA 02111-1307 USA
+
+ From Robert M. Ziff, "Four-tap shift-register-sequence
+ random-number generators," Computers in Physics 12(4), Jul/Aug
+ 1998, pp 385-392. A generalized feedback shift-register (GFSR)
+ is basically an xor-sum of particular past lagged values. A
+ four-tap register looks like:
+ ra[nd] = ra[nd-A] ^ ra[nd-B] ^ ra[nd-C] ^ ra[nd-D]
+
+ Ziff notes that "it is now widely known" that two-tap registers
+ have serious flaws, the most obvious one being the three-point
+ correlation that comes from the defn of the generator. Nice
+ mathematical properties can be derived for GFSR's, and numerics
+ bears out the claim that 4-tap GFSR's with appropriately chosen
+ offsets are as random as can be measured, using the author's test.
+
+ This implementation uses the values suggested the the author's
+ example on p392, but altered to fit the GSL framework. The "state"
+ is 2^14 longs, or 64Kbytes; 2^14 is the smallest power of two that
+ is larger than D, the largest offset. We really only need a state
+ with the last D values, but by going to a power of two, we can do a
+ masking operation instead of a modulo, and this is presumably
+ faster, though I haven't actually tried it. The article actually
+ suggested a short/fast hack:
+
+ #define RandomInteger (++nd, ra[nd&M]=ra[(nd-A)&M]\
+ ^ra[(nd-B)&M]^ra[(nd-C)&M]^ra[(nd-D)&M])
+
+ so that (as long as you've defined nd,ra[M+1]), then you ca do things
+ like: 'if (RandomInteger < p) {...}'.
+
+ Note that n&M varies from 0 to M, *including* M, so that the
+ array has to be of size M+1. Since M+1 is a power of two, n&M
+ is a potentially quicker implementation of the equivalent n%(M+1).
+
+ This implementation copyright (C) 1998 James Theiler, based on
+ the example mt.c in the GSL, as implemented by Brian Gough.
+*/
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+static inline unsigned long int gfsr4_get (void *vstate);
+static double gfsr4_get_double (void *vstate);
+static void gfsr4_set (void *state, unsigned long int s);
+
+/* Magic numbers */
+#define A 471
+#define B 1586
+#define C 6988
+#define D 9689
+#define M 16383 /* = 2^14-1 */
+/* #define M 0x0003fff */
+
+typedef struct
+ {
+ int nd;
+ unsigned long ra[M+1];
+ }
+gfsr4_state_t;
+
+static inline unsigned long
+gfsr4_get (void *vstate)
+{
+ gfsr4_state_t *state = (gfsr4_state_t *) vstate;
+
+ state->nd = ((state->nd)+1)&M;
+ return state->ra[(state->nd)] =
+ state->ra[((state->nd)+(M+1-A))&M]^
+ state->ra[((state->nd)+(M+1-B))&M]^
+ state->ra[((state->nd)+(M+1-C))&M]^
+ state->ra[((state->nd)+(M+1-D))&M];
+
+}
+
+static double
+gfsr4_get_double (void * vstate)
+{
+ return gfsr4_get (vstate) / 4294967296.0 ;
+}
+
+static void
+gfsr4_set (void *vstate, unsigned long int s)
+{
+ gfsr4_state_t *state = (gfsr4_state_t *) vstate;
+ int i, j;
+ /* Masks for turning on the diagonal bit and turning off the
+ leftmost bits */
+ unsigned long int msb = 0x80000000UL;
+ unsigned long int mask = 0xffffffffUL;
+
+ if (s == 0)
+ s = 4357; /* the default seed is 4357 */
+
+ /* We use the congruence s_{n+1} = (69069*s_n) mod 2^32 to
+ initialize the state. This works because ANSI-C unsigned long
+ integer arithmetic is automatically modulo 2^32 (or a higher
+ power of two), so we can safely ignore overflow. */
+
+#define LCG(n) ((69069 * n) & 0xffffffffUL)
+
+ /* Brian Gough suggests this to avoid low-order bit correlations */
+ for (i = 0; i <= M; i++)
+ {
+ unsigned long t = 0 ;
+ unsigned long bit = msb ;
+ for (j = 0; j < 32; j++)
+ {
+ s = LCG(s) ;
+ if (s & msb)
+ t |= bit ;
+ bit >>= 1 ;
+ }
+ state->ra[i] = t ;
+ }
+
+ /* Perform the "orthogonalization" of the matrix */
+ /* Based on the orthogonalization used in r250, as suggested initially
+ * by Kirkpatrick and Stoll, and pointed out to me by Brian Gough
+ */
+
+ /* BJG: note that this orthogonalisation doesn't have any effect
+ here because the the initial 6695 elements do not participate in
+ the calculation. For practical purposes this orthogonalisation
+ is somewhat irrelevant, because the probability of the original
+ sequence being degenerate should be exponentially small. */
+
+ for (i=0; i<32; ++i) {
+ int k=7+i*3;
+ state->ra[k] &= mask; /* Turn off bits left of the diagonal */
+ state->ra[k] |= msb; /* Turn on the diagonal bit */
+ mask >>= 1;
+ msb >>= 1;
+ }
+
+ state->nd = i;
+}
+
+static const gsl_rng_type gfsr4_type =
+{"gfsr4", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (gfsr4_state_t),
+ &gfsr4_set,
+ &gfsr4_get,
+ &gfsr4_get_double};
+
+const gsl_rng_type *gsl_rng_gfsr4 = &gfsr4_type;
+
+
+
+
+
diff --git a/gsl-1.9/rng/gsl_rng.h b/gsl-1.9/rng/gsl_rng.h
new file mode 100644
index 0000000..a7c3a49
--- /dev/null
+++ b/gsl-1.9/rng/gsl_rng.h
@@ -0,0 +1,218 @@
+/* rng/gsl_rng.h
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GSL_RNG_H__
+#define __GSL_RNG_H__
+#include <stdlib.h>
+#include <gsl/gsl_types.h>
+#include <gsl/gsl_errno.h>
+
+#undef __BEGIN_DECLS
+#undef __END_DECLS
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS /* empty */
+# define __END_DECLS /* empty */
+#endif
+
+__BEGIN_DECLS
+
+typedef struct
+ {
+ const char *name;
+ unsigned long int max;
+ unsigned long int min;
+ size_t size;
+ void (*set) (void *state, unsigned long int seed);
+ unsigned long int (*get) (void *state);
+ double (*get_double) (void *state);
+ }
+gsl_rng_type;
+
+typedef struct
+ {
+ const gsl_rng_type * type;
+ void *state;
+ }
+gsl_rng;
+
+
+/* These structs also need to appear in default.c so you can select
+ them via the environment variable GSL_RNG_TYPE */
+
+GSL_VAR const gsl_rng_type *gsl_rng_borosh13;
+GSL_VAR const gsl_rng_type *gsl_rng_coveyou;
+GSL_VAR const gsl_rng_type *gsl_rng_cmrg;
+GSL_VAR const gsl_rng_type *gsl_rng_fishman18;
+GSL_VAR const gsl_rng_type *gsl_rng_fishman20;
+GSL_VAR const gsl_rng_type *gsl_rng_fishman2x;
+GSL_VAR const gsl_rng_type *gsl_rng_gfsr4;
+GSL_VAR const gsl_rng_type *gsl_rng_knuthran;
+GSL_VAR const gsl_rng_type *gsl_rng_knuthran2;
+GSL_VAR const gsl_rng_type *gsl_rng_knuthran2002;
+GSL_VAR const gsl_rng_type *gsl_rng_lecuyer21;
+GSL_VAR const gsl_rng_type *gsl_rng_minstd;
+GSL_VAR const gsl_rng_type *gsl_rng_mrg;
+GSL_VAR const gsl_rng_type *gsl_rng_mt19937;
+GSL_VAR const gsl_rng_type *gsl_rng_mt19937_1999;
+GSL_VAR const gsl_rng_type *gsl_rng_mt19937_1998;
+GSL_VAR const gsl_rng_type *gsl_rng_r250;
+GSL_VAR const gsl_rng_type *gsl_rng_ran0;
+GSL_VAR const gsl_rng_type *gsl_rng_ran1;
+GSL_VAR const gsl_rng_type *gsl_rng_ran2;
+GSL_VAR const gsl_rng_type *gsl_rng_ran3;
+GSL_VAR const gsl_rng_type *gsl_rng_rand;
+GSL_VAR const gsl_rng_type *gsl_rng_rand48;
+GSL_VAR const gsl_rng_type *gsl_rng_random128_bsd;
+GSL_VAR const gsl_rng_type *gsl_rng_random128_glibc2;
+GSL_VAR const gsl_rng_type *gsl_rng_random128_libc5;
+GSL_VAR const gsl_rng_type *gsl_rng_random256_bsd;
+GSL_VAR const gsl_rng_type *gsl_rng_random256_glibc2;
+GSL_VAR const gsl_rng_type *gsl_rng_random256_libc5;
+GSL_VAR const gsl_rng_type *gsl_rng_random32_bsd;
+GSL_VAR const gsl_rng_type *gsl_rng_random32_glibc2;
+GSL_VAR const gsl_rng_type *gsl_rng_random32_libc5;
+GSL_VAR const gsl_rng_type *gsl_rng_random64_bsd;
+GSL_VAR const gsl_rng_type *gsl_rng_random64_glibc2;
+GSL_VAR const gsl_rng_type *gsl_rng_random64_libc5;
+GSL_VAR const gsl_rng_type *gsl_rng_random8_bsd;
+GSL_VAR const gsl_rng_type *gsl_rng_random8_glibc2;
+GSL_VAR const gsl_rng_type *gsl_rng_random8_libc5;
+GSL_VAR const gsl_rng_type *gsl_rng_random_bsd;
+GSL_VAR const gsl_rng_type *gsl_rng_random_glibc2;
+GSL_VAR const gsl_rng_type *gsl_rng_random_libc5;
+GSL_VAR const gsl_rng_type *gsl_rng_randu;
+GSL_VAR const gsl_rng_type *gsl_rng_ranf;
+GSL_VAR const gsl_rng_type *gsl_rng_ranlux;
+GSL_VAR const gsl_rng_type *gsl_rng_ranlux389;
+GSL_VAR const gsl_rng_type *gsl_rng_ranlxd1;
+GSL_VAR const gsl_rng_type *gsl_rng_ranlxd2;
+GSL_VAR const gsl_rng_type *gsl_rng_ranlxs0;
+GSL_VAR const gsl_rng_type *gsl_rng_ranlxs1;
+GSL_VAR const gsl_rng_type *gsl_rng_ranlxs2;
+GSL_VAR const gsl_rng_type *gsl_rng_ranmar;
+GSL_VAR const gsl_rng_type *gsl_rng_slatec;
+GSL_VAR const gsl_rng_type *gsl_rng_taus;
+GSL_VAR const gsl_rng_type *gsl_rng_taus2;
+GSL_VAR const gsl_rng_type *gsl_rng_taus113;
+GSL_VAR const gsl_rng_type *gsl_rng_transputer;
+GSL_VAR const gsl_rng_type *gsl_rng_tt800;
+GSL_VAR const gsl_rng_type *gsl_rng_uni;
+GSL_VAR const gsl_rng_type *gsl_rng_uni32;
+GSL_VAR const gsl_rng_type *gsl_rng_vax;
+GSL_VAR const gsl_rng_type *gsl_rng_waterman14;
+GSL_VAR const gsl_rng_type *gsl_rng_zuf;
+
+const gsl_rng_type ** gsl_rng_types_setup(void);
+
+GSL_VAR const gsl_rng_type *gsl_rng_default;
+GSL_VAR unsigned long int gsl_rng_default_seed;
+
+gsl_rng *gsl_rng_alloc (const gsl_rng_type * T);
+int gsl_rng_memcpy (gsl_rng * dest, const gsl_rng * src);
+gsl_rng *gsl_rng_clone (const gsl_rng * r);
+
+void gsl_rng_free (gsl_rng * r);
+
+void gsl_rng_set (const gsl_rng * r, unsigned long int seed);
+unsigned long int gsl_rng_max (const gsl_rng * r);
+unsigned long int gsl_rng_min (const gsl_rng * r);
+const char *gsl_rng_name (const gsl_rng * r);
+
+int gsl_rng_fread (FILE * stream, gsl_rng * r);
+int gsl_rng_fwrite (FILE * stream, const gsl_rng * r);
+
+size_t gsl_rng_size (const gsl_rng * r);
+void * gsl_rng_state (const gsl_rng * r);
+
+void gsl_rng_print_state (const gsl_rng * r);
+
+const gsl_rng_type * gsl_rng_env_setup (void);
+
+unsigned long int gsl_rng_get (const gsl_rng * r);
+double gsl_rng_uniform (const gsl_rng * r);
+double gsl_rng_uniform_pos (const gsl_rng * r);
+unsigned long int gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n);
+
+
+#ifdef HAVE_INLINE
+extern inline unsigned long int gsl_rng_get (const gsl_rng * r);
+
+extern inline unsigned long int
+gsl_rng_get (const gsl_rng * r)
+{
+ return (r->type->get) (r->state);
+}
+
+extern inline double gsl_rng_uniform (const gsl_rng * r);
+
+extern inline double
+gsl_rng_uniform (const gsl_rng * r)
+{
+ return (r->type->get_double) (r->state);
+}
+
+extern inline double gsl_rng_uniform_pos (const gsl_rng * r);
+
+extern inline double
+gsl_rng_uniform_pos (const gsl_rng * r)
+{
+ double x ;
+ do
+ {
+ x = (r->type->get_double) (r->state) ;
+ }
+ while (x == 0) ;
+
+ return x ;
+}
+
+extern inline unsigned long int gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n);
+
+extern inline unsigned long int
+gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n)
+{
+ unsigned long int offset = r->type->min;
+ unsigned long int range = r->type->max - offset;
+ unsigned long int scale;
+ unsigned long int k;
+
+ if (n > range || n == 0)
+ {
+ GSL_ERROR_VAL ("invalid n, either 0 or exceeds maximum value of generator",
+ GSL_EINVAL, 0) ;
+ }
+
+ scale = range / n;
+
+ do
+ {
+ k = (((r->type->get) (r->state)) - offset) / scale;
+ }
+ while (k >= n);
+
+ return k;
+}
+#endif /* HAVE_INLINE */
+
+__END_DECLS
+
+#endif /* __GSL_RNG_H__ */
diff --git a/gsl-1.9/rng/knuthran.c b/gsl-1.9/rng/knuthran.c
new file mode 100644
index 0000000..e83678b
--- /dev/null
+++ b/gsl-1.9/rng/knuthran.c
@@ -0,0 +1,177 @@
+/* rng/knuthran.c
+ *
+ * Copyright (C) 2001 Brian Gough, Carlo Perassi
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * This generator is taken from
+ *
+ * Donald E. Knuth
+ * The Art of Computer Programming
+ * Volume 2
+ * Third Edition
+ * Addison-Wesley
+ * Section 3.6
+ *
+ * The comments are taken from the book
+ * Our comments are signed
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+#define BUFLEN 2009 /* [Brian]: length of the buffer aa[] */
+#define KK 100 /* the long lag */
+#define LL 37 /* the short lag */
+#define MM (1L << 30) /* the modulus */
+#define TT 70 /* guaranteed separation between streams */
+
+#define evenize(x) ((x) & (MM - 2)) /* make x even */
+#define is_odd(x) ((x) & 1) /* the units bit of x */
+#define mod_diff(x, y) (((x) - (y)) & (MM - 1)) /* (x - y) mod MM */
+
+static inline void ran_array (unsigned long int aa[], unsigned int n,
+ unsigned long int ran_x[]);
+static inline unsigned long int ran_get (void *vstate);
+static double ran_get_double (void *vstate);
+static void ran_set (void *state, unsigned long int s);
+
+typedef struct
+{
+ unsigned int i;
+ unsigned long int aa[BUFLEN]; /* [Carlo]: I can't pass n to ran_array like
+ Knuth does */
+ unsigned long int ran_x[KK]; /* the generator state */
+}
+ran_state_t;
+
+static inline void
+ran_array (unsigned long int aa[], unsigned int n, unsigned long int ran_x[])
+{
+ unsigned int i;
+ unsigned int j;
+
+ for (j = 0; j < KK; j++)
+ aa[j] = ran_x[j];
+
+ for (; j < n; j++)
+ aa[j] = mod_diff (aa[j - KK], aa[j - LL]);
+
+ for (i = 0; i < LL; i++, j++)
+ ran_x[i] = mod_diff (aa[j - KK], aa[j - LL]);
+
+ for (; i < KK; i++, j++)
+ ran_x[i] = mod_diff (aa[j - KK], ran_x[i - LL]);
+}
+
+static inline unsigned long int
+ran_get (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ unsigned int i = state->i;
+
+ if (i == 0)
+ {
+ /* fill buffer with new random numbers */
+ ran_array (state->aa, BUFLEN, state->ran_x);
+ }
+
+ state->i = (i + 1) % BUFLEN;
+
+ return state->aa[i];
+}
+
+static double
+ran_get_double (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ return ran_get (state) / 1073741824.0; /* [Carlo]: RAND_MAX + 1 */
+}
+
+static void
+ran_set (void *vstate, unsigned long int s)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ long x[KK + KK - 1]; /* the preparation buffer */
+
+ register int j;
+ register int t;
+ register long ss = evenize (s + 2);
+
+ for (j = 0; j < KK; j++)
+ {
+ x[j] = ss; /* bootstrap the buffer */
+ ss <<= 1;
+ if (ss >= MM) /* cyclic shift 29 bits */
+ ss -= MM - 2;
+ }
+ for (; j < KK + KK - 1; j++)
+ x[j] = 0;
+ x[1]++; /* make x[1] (and only x[1]) odd */
+ ss = s & (MM - 1);
+ t = TT - 1;
+ while (t)
+ {
+ for (j = KK - 1; j > 0; j--) /* square */
+ x[j + j] = x[j];
+ for (j = KK + KK - 2; j > KK - LL; j -= 2)
+ x[KK + KK - 1 - j] = evenize (x[j]);
+ for (j = KK + KK - 2; j >= KK; j--)
+ if (is_odd (x[j]))
+ {
+ x[j - (KK - LL)] = mod_diff (x[j - (KK - LL)], x[j]);
+ x[j - KK] = mod_diff (x[j - KK], x[j]);
+ }
+ if (is_odd (ss))
+ { /* multiply by "z" */
+ for (j = KK; j > 0; j--)
+ x[j] = x[j - 1];
+ x[0] = x[KK]; /* shift the buffer cyclically */
+ if (is_odd (x[KK]))
+ x[LL] = mod_diff (x[LL], x[KK]);
+ }
+ if (ss)
+ ss >>= 1;
+ else
+ t--;
+ }
+
+ state->i = 0;
+
+ for (j = 0; j < LL; j++)
+ state->ran_x[j + KK - LL] = x[j];
+ for (; j < KK; j++)
+ state->ran_x[j - LL] = x[j];
+
+ return;
+}
+
+static const gsl_rng_type ran_type = {
+ "knuthran", /* name */
+ 0x3fffffffUL, /* RAND_MAX *//* [Carlo]: (2 ^ 30) - 1 */
+ 0, /* RAND_MIN */
+ sizeof (ran_state_t),
+ &ran_set,
+ &ran_get,
+ &ran_get_double
+};
+
+const gsl_rng_type *gsl_rng_knuthran = &ran_type;
diff --git a/gsl-1.9/rng/knuthran2.c b/gsl-1.9/rng/knuthran2.c
new file mode 100644
index 0000000..30cd9d2
--- /dev/null
+++ b/gsl-1.9/rng/knuthran2.c
@@ -0,0 +1,103 @@
+/* rng/knuthran2.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * This generator is taken from
+ *
+ * Donald E. Knuth
+ * The Art of Computer Programming
+ * Volume 2
+ * Third Edition
+ * Addison-Wesley
+ * Page 108
+ *
+ * This implementation copyright (C) 2001 Carlo Perassi
+ * and (C) 2003 Heiko Bauke.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+#include "schrage.c"
+
+#define AA1 271828183UL
+#define AA2 1833324378UL /* = -314159269 mod (2 ^ 31 -1) */
+#define MM 0x7fffffffUL /* 2 ^ 31 - 1 */
+#define CEIL_SQRT_MM 46341UL /* sqrt(2 ^ 31 - 1) */
+
+static inline unsigned long int ran_get (void *vstate);
+static double ran_get_double (void *vstate);
+static void ran_set (void *state, unsigned long int s);
+
+typedef struct
+{
+ unsigned long int x0;
+ unsigned long int x1;
+}
+ran_state_t;
+
+static inline unsigned long int
+ran_get (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ const unsigned long int xtmp = state->x1;
+ state->x1 = schrage_mult (AA1, state->x1, MM, CEIL_SQRT_MM)
+ + schrage_mult (AA2, state->x0, MM, CEIL_SQRT_MM);
+
+ if (state->x1 >= MM)
+ state->x1 -= MM;
+
+ state->x0 = xtmp;
+
+ return state->x1;
+}
+
+static double
+ran_get_double (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ return ran_get (state) / 2147483647.0;
+}
+
+static void
+ran_set (void *vstate, unsigned long int s)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ if ((s % MM) == 0)
+ s = 1; /* default seed is 1 */
+
+ state->x0 = s % MM;
+ state->x1 = s % MM;
+
+ return;
+}
+
+static const gsl_rng_type ran_type = {
+ "knuthran2", /* name */
+ MM - 1L, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (ran_state_t),
+ &ran_set,
+ &ran_get,
+ &ran_get_double
+};
+
+const gsl_rng_type *gsl_rng_knuthran2 = &ran_type;
diff --git a/gsl-1.9/rng/knuthran2002.c b/gsl-1.9/rng/knuthran2002.c
new file mode 100644
index 0000000..838b351
--- /dev/null
+++ b/gsl-1.9/rng/knuthran2002.c
@@ -0,0 +1,189 @@
+/* rng/knuthran2002.c
+ *
+ * Copyright (C) 2007 Brian Gough
+ * Copyright (C) 2001 Brian Gough, Carlo Perassi
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * This generator is taken from
+ *
+ * Donald E. Knuth, The Art of Computer Programming, Volume 2, Section 3.6
+ * Third Edition, Addison-Wesley,
+ *
+ * The modifications introduced in the 9th printing (2002) are
+ * included here; there's no backwards compatibility with the
+ * original. [ see http://www-cs-faculty.stanford.edu/~knuth/taocp.html ]
+ *
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+#define BUFLEN 1009 /* length of the buffer aa[] */
+#define KK 100 /* the long lag */
+#define LL 37 /* the short lag */
+#define MM (1L << 30) /* the modulus */
+#define TT 70 /* guaranteed separation between streams */
+
+#define is_odd(x) ((x) & 1) /* the units bit of x */
+#define mod_diff(x, y) (((x) - (y)) & (MM - 1)) /* (x - y) mod MM */
+
+static inline void ran_array (long int aa[], unsigned int n,
+ long int ran_x[]);
+static inline unsigned long int ran_get (void *vstate);
+static double ran_get_double (void *vstate);
+static void ran_set (void *state, unsigned long int s);
+
+typedef struct
+{
+ unsigned int i;
+ long int aa[BUFLEN];
+ long int ran_x[KK]; /* the generator state */
+}
+ran_state_t;
+
+static inline void
+ran_array (long int aa[], unsigned int n, long int ran_x[])
+{
+ unsigned int i;
+ unsigned int j;
+
+ for (j = 0; j < KK; j++)
+ aa[j] = ran_x[j];
+
+ for (; j < n; j++)
+ aa[j] = mod_diff (aa[j - KK], aa[j - LL]);
+
+ for (i = 0; i < LL; i++, j++)
+ ran_x[i] = mod_diff (aa[j - KK], aa[j - LL]);
+
+ for (; i < KK; i++, j++)
+ ran_x[i] = mod_diff (aa[j - KK], ran_x[i - LL]);
+}
+
+static inline unsigned long int
+ran_get (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ unsigned int i = state->i;
+ unsigned long int v;
+
+ if (i == 0)
+ {
+ /* fill buffer with new random numbers */
+ ran_array (state->aa, BUFLEN, state->ran_x);
+ }
+
+ v = state->aa[i];
+
+ state->i = (i + 1) % KK;
+
+ return v;
+}
+
+static double
+ran_get_double (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ return ran_get (state) / 1073741824.0; /* RAND_MAX + 1 */
+}
+
+static void
+ran_set (void *vstate, unsigned long int s)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ long x[KK + KK - 1]; /* the preparation buffer */
+
+ register int j;
+ register int t;
+ register long ss;
+
+ if (s == 0 )
+ s = 314159; /* default seed used by Knuth */
+
+ ss = (s + 2)&(MM-2);
+
+ for (j = 0; j < KK; j++)
+ {
+ x[j] = ss; /* bootstrap the buffer */
+ ss <<= 1;
+ if (ss >= MM) /* cyclic shift 29 bits */
+ ss -= MM - 2;
+ }
+ x[1]++; /* make x[1] (and only x[1]) odd */
+
+ ss = s & (MM - 1);
+ t = TT - 1;
+ while (t)
+ {
+ for (j = KK - 1; j > 0; j--) /* square */
+ {
+ x[j + j] = x[j];
+ x[j + j - 1] = 0;
+ }
+
+ for (j = KK + KK - 2; j >= KK; j--)
+ {
+ x[j - (KK - LL)] = mod_diff (x[j - (KK - LL)], x[j]);
+ x[j - KK] = mod_diff (x[j - KK], x[j]);
+ }
+
+ if (is_odd (ss))
+ { /* multiply by "z" */
+ for (j = KK; j > 0; j--)
+ {
+ x[j] = x[j - 1];
+ }
+ x[0] = x[KK]; /* shift the buffer cyclically */
+ x[LL] = mod_diff (x[LL], x[KK]);
+ }
+
+ if (ss)
+ ss >>= 1;
+ else
+ t--;
+ }
+
+ for (j = 0; j < LL; j++)
+ state->ran_x[j + KK - LL] = x[j];
+ for (; j < KK; j++)
+ state->ran_x[j - LL] = x[j];
+
+
+ for (j = 0; j< 10; j++)
+ ran_array(x, KK+KK-1, state->ran_x); /* warm things up */
+
+ state->i = 0;
+
+ return;
+}
+
+static const gsl_rng_type ran_type = {
+ "knuthran2002", /* name */
+ 0x3fffffffUL, /* RAND_MAX = (2 ^ 30) - 1 */
+ 0, /* RAND_MIN */
+ sizeof (ran_state_t),
+ &ran_set,
+ &ran_get,
+ &ran_get_double
+};
+
+const gsl_rng_type *gsl_rng_knuthran2002 = &ran_type;
diff --git a/gsl-1.9/rng/lecuyer21.c b/gsl-1.9/rng/lecuyer21.c
new file mode 100644
index 0000000..ee58128
--- /dev/null
+++ b/gsl-1.9/rng/lecuyer21.c
@@ -0,0 +1,99 @@
+/* rng/lecuyer21.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * This generator is taken from
+ *
+ * Donald E. Knuth
+ * The Art of Computer Programming
+ * Volume 2
+ * Third Edition
+ * Addison-Wesley
+ * Page 108
+ *
+ * This implementation copyright (C) 2001 Brian Gough, Carlo Perassi
+ * and (C) 2003 Heiko Bauke.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+#define AAA 40692
+#define MMM 2147483399UL
+#define QQQ 52774
+#define RRR 3791
+
+static inline unsigned long int ran_get (void *vstate);
+static double ran_get_double (void *vstate);
+static void ran_set (void *state, unsigned long int s);
+
+typedef struct
+{
+ unsigned long int x;
+}
+ran_state_t;
+
+static inline unsigned long int
+ran_get (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ long int y = state->x;
+ long int r = RRR * (y / QQQ);
+
+ y = AAA * (y % QQQ) - r;
+ if (y < 0)
+ y += MMM;
+
+ state->x = y;
+
+ return state->x;
+}
+
+static double
+ran_get_double (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ return ran_get (state) / 2147483399.0;
+}
+
+static void
+ran_set (void *vstate, unsigned long int s)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ if ((s%MMM) == 0)
+ s = 1; /* default seed is 1 */
+
+ state->x = s % MMM;
+
+ return;
+}
+
+static const gsl_rng_type ran_type = {
+ "lecuyer21", /* name */
+ MMM-1, /* RAND_MAX */
+ 1, /* RAND_MIN */
+ sizeof (ran_state_t),
+ &ran_set,
+ &ran_get,
+ &ran_get_double
+};
+
+const gsl_rng_type *gsl_rng_lecuyer21 = &ran_type;
diff --git a/gsl-1.9/rng/minstd.c b/gsl-1.9/rng/minstd.c
new file mode 100644
index 0000000..b3efa9e
--- /dev/null
+++ b/gsl-1.9/rng/minstd.c
@@ -0,0 +1,109 @@
+/* rng/minstd.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* MINSTD is Park and Miller's minimal standard generator (i.e. it's
+ not particularly good).
+
+ The sequence is
+
+ x_{n+1} = (a x_n) mod m
+
+ with a = 16807 and m = 2^31 - 1 = 2147483647. The seed specifies
+ the initial value, x_1.
+
+ The theoretical value of x_{10001} is 1043618065, starting with a
+ seed of x_1 = 1.
+
+ The period of this generator is 2^31.
+
+ It is used as the RNUN subroutine in the IMSL Library and the RAND
+ function in MATLAB. The generator is sometimes known by the acronym
+ "GGL" (I'm not sure what that stands for).
+
+ From: Park and Miller, "Random Number Generators: Good ones are
+ hard to find" Communications of the ACM, October 1988, Volume 31,
+ No 10, pages 1192-1201. */
+
+static inline unsigned long int minstd_get (void *vstate);
+static double minstd_get_double (void *vstate);
+static void minstd_set (void *state, unsigned long int s);
+
+static const long int m = 2147483647, a = 16807, q = 127773, r = 2836;
+
+typedef struct
+ {
+ unsigned long int x;
+ }
+minstd_state_t;
+
+static inline unsigned long int
+minstd_get (void *vstate)
+{
+ minstd_state_t *state = (minstd_state_t *) vstate;
+
+ const unsigned long int x = state->x;
+
+ const long int h = x / q;
+ const long int t = a * (x - h * q) - h * r;
+
+ if (t < 0)
+ {
+ state->x = t + m;
+ }
+ else
+ {
+ state->x = t;
+ }
+
+ return state->x;
+}
+
+static double
+minstd_get_double (void *vstate)
+{
+ return minstd_get (vstate) / 2147483647.0;
+}
+
+static void
+minstd_set (void *vstate, unsigned long int s)
+{
+ minstd_state_t *state = (minstd_state_t *) vstate;
+
+ if (s == 0)
+ s = 1; /* default seed is 1 */
+
+ state->x = s;
+
+ return;
+}
+
+static const gsl_rng_type minstd_type =
+{"minstd", /* name */
+ 2147483646, /* RAND_MAX */
+ 1, /* RAND_MIN */
+ sizeof (minstd_state_t),
+ &minstd_set,
+ &minstd_get,
+ &minstd_get_double};
+
+const gsl_rng_type *gsl_rng_minstd = &minstd_type;
diff --git a/gsl-1.9/rng/mrg.c b/gsl-1.9/rng/mrg.c
new file mode 100644
index 0000000..cb44b11
--- /dev/null
+++ b/gsl-1.9/rng/mrg.c
@@ -0,0 +1,149 @@
+/* rng/mrg.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is a fifth-order multiple recursive generator. The sequence is,
+
+ x_n = (a_1 x_{n-1} + a_5 x_{n-5}) mod m
+
+ with a_1 = 107374182, a_2 = a_3 = a_4 = 0, a_5 = 104480 and m = 2^31-1.
+
+ We initialize the generator with x_n = s_n MOD m for n = 1..5,
+ where s_n = (69069 * s_{n-1}) mod 2^32, and s_0 = s is the
+ user-supplied seed.
+
+ NOTE: According to the paper the seeds must lie in the range [0,
+ 2^31 - 2] with at least one non-zero value -- our seeding procedure
+ satisfies these constraints.
+
+ We then use 6 iterations of the generator to "warm up" the internal
+ state.
+
+ With this initialization procedure the theoretical value of
+ z_{10006} is 2064828650 for s = 1. The subscript 10006 means (1)
+ seed the generator with s = 1, (2) do the 6 warm-up iterations
+ that are part of the seeding process, (3) then do 10000 actual
+ iterations.
+
+ The period of this generator is about 2^155.
+
+ From: P. L'Ecuyer, F. Blouin, and R. Coutre, "A search for good
+ multiple recursive random number generators", ACM Transactions on
+ Modeling and Computer Simulation 3, 87-98 (1993). */
+
+static inline unsigned long int mrg_get (void *vstate);
+static double mrg_get_double (void *vstate);
+static void mrg_set (void *state, unsigned long int s);
+
+static const long int m = 2147483647;
+static const long int a1 = 107374182, q1 = 20, r1 = 7;
+static const long int a5 = 104480, q5 = 20554, r5 = 1727;
+
+typedef struct
+ {
+ long int x1, x2, x3, x4, x5;
+ }
+mrg_state_t;
+
+static inline unsigned long int
+mrg_get (void *vstate)
+{
+ mrg_state_t *state = (mrg_state_t *) vstate;
+
+ long int p1, h1, p5, h5;
+
+ h5 = state->x5 / q5;
+ p5 = a5 * (state->x5 - h5 * q5) - h5 * r5;
+ if (p5 > 0)
+ p5 -= m;
+
+ h1 = state->x1 / q1;
+ p1 = a1 * (state->x1 - h1 * q1) - h1 * r1;
+ if (p1 < 0)
+ p1 += m;
+
+ state->x5 = state->x4;
+ state->x4 = state->x3;
+ state->x3 = state->x2;
+ state->x2 = state->x1;
+
+ state->x1 = p1 + p5;
+
+ if (state->x1 < 0)
+ state->x1 += m;
+
+ return state->x1;
+}
+
+static double
+mrg_get_double (void *vstate)
+{
+ return mrg_get (vstate) / 2147483647.0 ;
+}
+
+
+static void
+mrg_set (void *vstate, unsigned long int s)
+{
+ /* An entirely adhoc way of seeding! This does **not** come from
+ L'Ecuyer et al */
+
+ mrg_state_t *state = (mrg_state_t *) vstate;
+
+ if (s == 0)
+ s = 1; /* default seed is 1 */
+
+#define LCG(n) ((69069 * n) & 0xffffffffUL)
+ s = LCG (s);
+ state->x1 = s % m;
+ s = LCG (s);
+ state->x2 = s % m;
+ s = LCG (s);
+ state->x3 = s % m;
+ s = LCG (s);
+ state->x4 = s % m;
+ s = LCG (s);
+ state->x5 = s % m;
+
+ /* "warm it up" with at least 5 calls to go through
+ all the x values */
+
+ mrg_get (state);
+ mrg_get (state);
+ mrg_get (state);
+ mrg_get (state);
+ mrg_get (state);
+ mrg_get (state);
+
+ return;
+}
+
+static const gsl_rng_type mrg_type =
+{"mrg", /* name */
+ 2147483646, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (mrg_state_t),
+ &mrg_set,
+ &mrg_get,
+ &mrg_get_double};
+
+const gsl_rng_type *gsl_rng_mrg = &mrg_type;
diff --git a/gsl-1.9/rng/mt.c b/gsl-1.9/rng/mt.c
new file mode 100644
index 0000000..46de635
--- /dev/null
+++ b/gsl-1.9/rng/mt.c
@@ -0,0 +1,241 @@
+/* This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details. You should have received
+ a copy of the GNU General Public License along with this program;
+ if not, write to the Free Foundation, Inc., 59 Temple Place, Suite
+ 330, Boston, MA 02111-1307 USA
+
+ Original implementation was copyright (C) 1997 Makoto Matsumoto and
+ Takuji Nishimura. Coded by Takuji Nishimura, considering the
+ suggestions by Topher Cooper and Marc Rieffel in July-Aug. 1997, "A
+ C-program for MT19937: Integer version (1998/4/6)"
+
+ This implementation copyright (C) 1998 Brian Gough. I reorganized
+ the code to use the module framework of GSL. The license on this
+ implementation was changed from LGPL to GPL, following paragraph 3
+ of the LGPL, version 2.
+
+ Update:
+
+ The seeding procedure has been updated to match the 10/99 release
+ of MT19937.
+
+ Update:
+
+ The seeding procedure has been updated again to match the 2002
+ release of MT19937
+
+ The original code included the comment: "When you use this, send an
+ email to: matumoto@math.keio.ac.jp with an appropriate reference to
+ your work".
+
+ Makoto Matsumoto has a web page with more information about the
+ generator, http://www.math.keio.ac.jp/~matumoto/emt.html.
+
+ The paper below has details of the algorithm.
+
+ From: Makoto Matsumoto and Takuji Nishimura, "Mersenne Twister: A
+ 623-dimensionally equidistributerd uniform pseudorandom number
+ generator". ACM Transactions on Modeling and Computer Simulation,
+ Vol. 8, No. 1 (Jan. 1998), Pages 3-30
+
+ You can obtain the paper directly from Makoto Matsumoto's web page.
+
+ The period of this generator is 2^{19937} - 1.
+
+*/
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+static inline unsigned long int mt_get (void *vstate);
+static double mt_get_double (void *vstate);
+static void mt_set (void *state, unsigned long int s);
+
+#define N 624 /* Period parameters */
+#define M 397
+
+/* most significant w-r bits */
+static const unsigned long UPPER_MASK = 0x80000000UL;
+
+/* least significant r bits */
+static const unsigned long LOWER_MASK = 0x7fffffffUL;
+
+typedef struct
+ {
+ unsigned long mt[N];
+ int mti;
+ }
+mt_state_t;
+
+static inline unsigned long
+mt_get (void *vstate)
+{
+ mt_state_t *state = (mt_state_t *) vstate;
+
+ unsigned long k ;
+ unsigned long int *const mt = state->mt;
+
+#define MAGIC(y) (((y)&0x1) ? 0x9908b0dfUL : 0)
+
+ if (state->mti >= N)
+ { /* generate N words at one time */
+ int kk;
+
+ for (kk = 0; kk < N - M; kk++)
+ {
+ unsigned long y = (mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK);
+ mt[kk] = mt[kk + M] ^ (y >> 1) ^ MAGIC(y);
+ }
+ for (; kk < N - 1; kk++)
+ {
+ unsigned long y = (mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK);
+ mt[kk] = mt[kk + (M - N)] ^ (y >> 1) ^ MAGIC(y);
+ }
+
+ {
+ unsigned long y = (mt[N - 1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
+ mt[N - 1] = mt[M - 1] ^ (y >> 1) ^ MAGIC(y);
+ }
+
+ state->mti = 0;
+ }
+
+ /* Tempering */
+
+ k = mt[state->mti];
+ k ^= (k >> 11);
+ k ^= (k << 7) & 0x9d2c5680UL;
+ k ^= (k << 15) & 0xefc60000UL;
+ k ^= (k >> 18);
+
+ state->mti++;
+
+ return k;
+}
+
+static double
+mt_get_double (void * vstate)
+{
+ return mt_get (vstate) / 4294967296.0 ;
+}
+
+static void
+mt_set (void *vstate, unsigned long int s)
+{
+ mt_state_t *state = (mt_state_t *) vstate;
+ int i;
+
+ if (s == 0)
+ s = 4357; /* the default seed is 4357 */
+
+ state->mt[0]= s & 0xffffffffUL;
+
+ for (i = 1; i < N; i++)
+ {
+ /* See Knuth's "Art of Computer Programming" Vol. 2, 3rd
+ Ed. p.106 for multiplier. */
+
+ state->mt[i] =
+ (1812433253UL * (state->mt[i-1] ^ (state->mt[i-1] >> 30)) + i);
+
+ state->mt[i] &= 0xffffffffUL;
+ }
+
+ state->mti = i;
+}
+
+static void
+mt_1999_set (void *vstate, unsigned long int s)
+{
+ mt_state_t *state = (mt_state_t *) vstate;
+ int i;
+
+ if (s == 0)
+ s = 4357; /* the default seed is 4357 */
+
+ /* This is the October 1999 version of the seeding procedure. It
+ was updated by the original developers to avoid the periodicity
+ in the simple congruence originally used.
+
+ Note that an ANSI-C unsigned long integer arithmetic is
+ automatically modulo 2^32 (or a higher power of two), so we can
+ safely ignore overflow. */
+
+#define LCG(x) ((69069 * x) + 1) &0xffffffffUL
+
+ for (i = 0; i < N; i++)
+ {
+ state->mt[i] = s & 0xffff0000UL;
+ s = LCG(s);
+ state->mt[i] |= (s &0xffff0000UL) >> 16;
+ s = LCG(s);
+ }
+
+ state->mti = i;
+}
+
+/* This is the original version of the seeding procedure, no longer
+ used but available for compatibility with the original MT19937. */
+
+static void
+mt_1998_set (void *vstate, unsigned long int s)
+{
+ mt_state_t *state = (mt_state_t *) vstate;
+ int i;
+
+ if (s == 0)
+ s = 4357; /* the default seed is 4357 */
+
+ state->mt[0] = s & 0xffffffffUL;
+
+#define LCG1998(n) ((69069 * n) & 0xffffffffUL)
+
+ for (i = 1; i < N; i++)
+ state->mt[i] = LCG1998 (state->mt[i - 1]);
+
+ state->mti = i;
+}
+
+static const gsl_rng_type mt_type =
+{"mt19937", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (mt_state_t),
+ &mt_set,
+ &mt_get,
+ &mt_get_double};
+
+static const gsl_rng_type mt_1999_type =
+{"mt19937_1999", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (mt_state_t),
+ &mt_1999_set,
+ &mt_get,
+ &mt_get_double};
+
+static const gsl_rng_type mt_1998_type =
+{"mt19937_1998", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (mt_state_t),
+ &mt_1998_set,
+ &mt_get,
+ &mt_get_double};
+
+const gsl_rng_type *gsl_rng_mt19937 = &mt_type;
+const gsl_rng_type *gsl_rng_mt19937_1999 = &mt_1999_type;
+const gsl_rng_type *gsl_rng_mt19937_1998 = &mt_1998_type;
+
+/* MT19937 is the default generator, so define that here too */
+
+const gsl_rng_type *gsl_rng_default = &mt_type;
+unsigned long int gsl_rng_default_seed = 0;
diff --git a/gsl-1.9/rng/r250.c b/gsl-1.9/rng/r250.c
new file mode 100644
index 0000000..e5b4df1
--- /dev/null
+++ b/gsl-1.9/rng/r250.c
@@ -0,0 +1,172 @@
+/* rng/r250.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is a shift-register random number generator. The sequence is
+
+ x_n = x_{n-103} ^ x_{n-250} ("^" means XOR)
+
+ defined on 32-bit words.
+
+ BJG: Note that this implementation actually uses the sequence, x_n
+ = x_{n-147} ^ x_{n-250} which generates the outputs in
+ time-reversed order but is otherwise completely equivalent.
+
+ The first 250 elements x_1 .. x_250 are first initialized as x_n =
+ s_n, where s_n = (69069*s_{n-1}) mod 2^32 and s_0=s is the
+ user-supplied seed. To ensure that the sequence does not lie on a
+ subspace we force 32 of the entries to be linearly independent. We
+ take the 32 elements x[3], x[10], x[17], x[24], ..., 213 and apply
+ the following operations,
+
+ x[3] &= 11111111111111111111111111111111
+ x[3] |= 10000000000000000000000000000000
+ x[10] &= 01111111111111111111111111111111
+ x[10] |= 01000000000000000000000000000000
+ x[17] &= 00111111111111111111111111111111
+ x[17] |= 00100000000000000000000000000000
+ .... ...
+ x[206] &= 00000000000000000000000000000111
+ x[206] |= 00000000000000000000000000000100
+ x[213] &= 00000000000000000000000000000011
+ x[213] |= 00000000000000000000000000000010
+ x[220] &= 00000000000000000000000000000001
+ x[220] |= 00000000000000000000000000000001
+
+ i.e. if we consider the bits of the 32 elements as forming a 32x32
+ array then we are setting the diagonal bits of the array to one and
+ masking the lower triangle below the diagonal to zero.
+
+ With this initialization procedure the theoretical value of
+ x_{10001} is 1100653588 for s = 1 (Actually I got this by running
+ the original code). The subscript 10001 means (1) seed the
+ generator with s = 1 and then do 10000 actual iterations.
+
+ The period of this generator is about 2^250.
+
+ The algorithm works for any number of bits. It is implemented here
+ for 32 bits.
+
+ From: S. Kirkpatrick and E. Stoll, "A very fast shift-register
+ sequence random number generator", Journal of Computational Physics,
+ 40, 517-526 (1981). */
+
+static inline unsigned long int r250_get (void *vstate);
+static double r250_get_double (void *vstate);
+static void r250_set (void *state, unsigned long int s);
+
+typedef struct
+ {
+ int i;
+ unsigned long x[250];
+ }
+r250_state_t;
+
+static inline unsigned long int
+r250_get (void *vstate)
+{
+ r250_state_t *state = (r250_state_t *) vstate;
+ unsigned long int k;
+ int j;
+
+ int i = state->i;
+
+ if (i >= 147)
+ {
+ j = i - 147;
+ }
+ else
+ {
+ j = i + 103;
+ }
+
+ k = state->x[i] ^ state->x[j];
+ state->x[i] = k;
+
+ if (i >= 249)
+ {
+ state->i = 0;
+ }
+ else
+ {
+ state->i = i + 1;
+ }
+
+ return k;
+}
+
+static double
+r250_get_double (void *vstate)
+{
+ return r250_get (vstate) / 4294967296.0 ;
+}
+
+static void
+r250_set (void *vstate, unsigned long int s)
+{
+ r250_state_t *state = (r250_state_t *) vstate;
+
+ int i;
+
+ if (s == 0)
+ s = 1; /* default seed is 1 */
+
+ state->i = 0;
+
+#define LCG(n) ((69069 * n) & 0xffffffffUL)
+
+ for (i = 0; i < 250; i++) /* Fill the buffer */
+ {
+ s = LCG (s);
+ state->x[i] = s;
+ }
+
+ {
+ /* Masks for turning on the diagonal bit and turning off the
+ leftmost bits */
+
+ unsigned long int msb = 0x80000000UL;
+ unsigned long int mask = 0xffffffffUL;
+
+ for (i = 0; i < 32; i++)
+ {
+ int k = 7 * i + 3; /* Select a word to operate on */
+ state->x[k] &= mask; /* Turn off bits left of the diagonal */
+ state->x[k] |= msb; /* Turn on the diagonal bit */
+ mask >>= 1;
+ msb >>= 1;
+ }
+ }
+
+ return;
+}
+
+static const gsl_rng_type r250_type =
+{"r250", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (r250_state_t),
+ &r250_set,
+ &r250_get,
+ &r250_get_double};
+
+const gsl_rng_type *gsl_rng_r250 = &r250_type;
diff --git a/gsl-1.9/rng/ran0.c b/gsl-1.9/rng/ran0.c
new file mode 100644
index 0000000..108a905
--- /dev/null
+++ b/gsl-1.9/rng/ran0.c
@@ -0,0 +1,100 @@
+/* rng/ran0.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_errno.h>
+#include <gsl/gsl_rng.h>
+
+/* This is an implementation of the algorithm used in Numerical
+ Recipe's ran0 generator. It is the same as MINSTD with an XOR mask
+ of 123459876 on the seed.
+
+ The period of this generator is 2^31.
+
+ Note, if you choose a seed of 123459876 it would give a degenerate
+ series 0,0,0,0, ... I've made that into an error. */
+
+static inline unsigned long int ran0_get (void *vstate);
+static double ran0_get_double (void *vstate);
+static void ran0_set (void *state, unsigned long int s);
+
+static const long int m = 2147483647, a = 16807, q = 127773, r = 2836;
+static const unsigned long int mask = 123459876;
+
+typedef struct
+ {
+ unsigned long int x;
+ }
+ran0_state_t;
+
+static inline unsigned long int
+ran0_get (void *vstate)
+{
+ ran0_state_t *state = (ran0_state_t *) vstate;
+
+ const unsigned long int x = state->x;
+
+ const long int h = x / q;
+ const long int t = a * (x - h * q) - h * r;
+
+ if (t < 0)
+ {
+ state->x = t + m;
+ }
+ else
+ {
+ state->x = t;
+ }
+
+ return state->x;
+}
+
+static double
+ran0_get_double (void *vstate)
+{
+ return ran0_get (vstate) / 2147483647.0 ;
+}
+
+static void
+ran0_set (void *vstate, unsigned long int s)
+{
+ ran0_state_t *state = (ran0_state_t *) vstate;
+
+ if (s == mask)
+ {
+ GSL_ERROR_VOID ("ran0 should not use seed == mask",
+ GSL_EINVAL);
+ }
+
+ state->x = s ^ mask;
+
+ return;
+}
+
+static const gsl_rng_type ran0_type =
+{"ran0", /* name */
+ 2147483646, /* RAND_MAX */
+ 1, /* RAND_MIN */
+ sizeof (ran0_state_t),
+ &ran0_set,
+ &ran0_get,
+ &ran0_get_double};
+
+const gsl_rng_type *gsl_rng_ran0 = &ran0_type;
diff --git a/gsl-1.9/rng/ran1.c b/gsl-1.9/rng/ran1.c
new file mode 100644
index 0000000..0802ad2
--- /dev/null
+++ b/gsl-1.9/rng/ran1.c
@@ -0,0 +1,130 @@
+/* rng/ran1.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is an implementation of the algorithm used in Numerical
+ Recipe's ran1 generator. It is MINSTD with a 32-element
+ shuffle-box. */
+
+static inline unsigned long int ran1_get (void *vstate);
+static double ran1_get_double (void *vstate);
+static void ran1_set (void *state, unsigned long int s);
+
+static const long int m = 2147483647, a = 16807, q = 127773, r = 2836;
+
+#define N_SHUFFLE 32
+#define N_DIV (1 + 2147483646/N_SHUFFLE)
+
+typedef struct
+ {
+ unsigned long int x;
+ unsigned long int n;
+ unsigned long int shuffle[N_SHUFFLE];
+ }
+ran1_state_t;
+
+static inline unsigned long int
+ran1_get (void *vstate)
+{
+ ran1_state_t *state = (ran1_state_t *) vstate;
+
+ const unsigned long int x = state->x;
+
+ const long int h = x / q;
+ const long int t = a * (x - h * q) - h * r;
+
+ if (t < 0)
+ {
+ state->x = t + m;
+ }
+ else
+ {
+ state->x = t;
+ }
+
+ {
+ unsigned long int j = state->n / N_DIV;
+ state->n = state->shuffle[j];
+ state->shuffle[j] = state->x;
+ }
+
+ return state->n;
+}
+
+static double
+ran1_get_double (void *vstate)
+{
+ float x_max = 1 - 1.2e-7f ; /* Numerical Recipes version of 1-FLT_EPS */
+
+ float x = ran1_get (vstate) / 2147483647.0f ;
+
+ if (x > x_max)
+ return x_max ;
+
+ return x ;
+}
+
+
+static void
+ran1_set (void *vstate, unsigned long int s)
+{
+ ran1_state_t *state = (ran1_state_t *) vstate;
+ int i;
+
+ if (s == 0)
+ s = 1; /* default seed is 1 */
+
+ for (i = 0; i < 8; i++)
+ {
+ long int h = s / q;
+ long int t = a * (s - h * q) - h * r;
+ if (t < 0)
+ t += m;
+ s = t;
+ }
+
+ for (i = N_SHUFFLE - 1; i >= 0; i--)
+ {
+ long int h = s / q;
+ long int t = a * (s - h * q) - h * r;
+ if (t < 0)
+ t += m;
+ s = t;
+ state->shuffle[i] = s;
+ }
+
+ state->x = s;
+ state->n = s;
+
+ return;
+}
+
+static const gsl_rng_type ran1_type =
+{"ran1", /* name */
+ 2147483646, /* RAND_MAX */
+ 1, /* RAND_MIN */
+ sizeof (ran1_state_t),
+ &ran1_set,
+ &ran1_get,
+ &ran1_get_double};
+
+const gsl_rng_type *gsl_rng_ran1 = &ran1_type;
diff --git a/gsl-1.9/rng/ran2.c b/gsl-1.9/rng/ran2.c
new file mode 100644
index 0000000..ec6d38d
--- /dev/null
+++ b/gsl-1.9/rng/ran2.c
@@ -0,0 +1,146 @@
+/* rng/ran2.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is an implementation of the algorithm used in Numerical
+ Recipe's ran2 generator. It is a L'Ecuyer combined recursive
+ generator with a 32-element shuffle-box.
+
+ As far as I can tell, in general the effects of adding a shuffle
+ box cannot be proven theoretically, so the period of this generator
+ is unknown.
+
+ The period of the underlying combined generator is O(2^60). */
+
+static inline unsigned long int ran2_get (void *vstate);
+static double ran2_get_double (void *vstate);
+static void ran2_set (void *state, unsigned long int s);
+
+static const long int m1 = 2147483563, a1 = 40014, q1 = 53668, r1 = 12211;
+static const long int m2 = 2147483399, a2 = 40692, q2 = 52774, r2 = 3791;
+
+#define N_SHUFFLE 32
+#define N_DIV (1 + 2147483562/N_SHUFFLE)
+
+typedef struct
+ {
+ unsigned long int x;
+ unsigned long int y;
+ unsigned long int n;
+ unsigned long int shuffle[N_SHUFFLE];
+ }
+ran2_state_t;
+
+static inline unsigned long int
+ran2_get (void *vstate)
+{
+ ran2_state_t *state = (ran2_state_t *) vstate;
+
+ const unsigned long int x = state->x;
+ const unsigned long int y = state->y;
+
+ long int h1 = x / q1;
+ long int t1 = a1 * (x - h1 * q1) - h1 * r1;
+
+ long int h2 = y / q2;
+ long int t2 = a2 * (y - h2 * q2) - h2 * r2;
+
+ if (t1 < 0)
+ t1 += m1;
+
+ if (t2 < 0)
+ t2 += m2;
+
+ state->x = t1;
+ state->y = t2;
+
+ {
+ unsigned long int j = state->n / N_DIV;
+ long int delta = state->shuffle[j] - t2;
+ if (delta < 1)
+ delta += m1 - 1;
+ state->n = delta;
+ state->shuffle[j] = t1;
+ }
+
+ return state->n;
+}
+
+static double
+ran2_get_double (void *vstate)
+{
+ float x_max = 1 - 1.2e-7f ; /* Numerical Recipes version of 1-FLT_EPS */
+
+ float x = ran2_get (vstate) / 2147483563.0f ;
+
+ if (x > x_max)
+ return x_max ;
+
+ return x ;
+}
+
+static void
+ran2_set (void *vstate, unsigned long int s)
+{
+ ran2_state_t *state = (ran2_state_t *) vstate;
+ int i;
+
+ if (s == 0)
+ s = 1; /* default seed is 1 */
+
+ state->y = s;
+
+ for (i = 0; i < 8; i++)
+ {
+ long int h = s / q1;
+ long int t = a1 * (s - h * q1) - h * r1;
+ if (t < 0)
+ t += m1;
+ s = t;
+ }
+
+ for (i = N_SHUFFLE - 1; i >= 0; i--)
+ {
+ long int h = s / q1;
+ long int t = a1 * (s - h * q1) - h * r1;
+ if (t < 0)
+ t += m1;
+ s = t;
+ state->shuffle[i] = s;
+ }
+
+ state->x = s;
+ state->n = s;
+
+ return;
+}
+
+static const gsl_rng_type ran2_type =
+{"ran2", /* name */
+ 2147483562, /* RAND_MAX */
+ 1, /* RAND_MIN */
+ sizeof (ran2_state_t),
+ &ran2_set,
+ &ran2_get,
+ &ran2_get_double};
+
+const gsl_rng_type *gsl_rng_ran2 = &ran2_type;
diff --git a/gsl-1.9/rng/ran3.c b/gsl-1.9/rng/ran3.c
new file mode 100644
index 0000000..7ccc47c
--- /dev/null
+++ b/gsl-1.9/rng/ran3.c
@@ -0,0 +1,132 @@
+/* rng/ran3.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is an implementation of the algorithm used in Knuths's
+ subtractive generator, with the Numerical Recipe's ran3 paramters.
+ It is a subtractive lagged fibonnaci generator. */
+
+static inline unsigned long int ran3_get (void *vstate);
+static double ran3_get_double (void *vstate);
+static void ran3_set (void *state, unsigned long int s);
+
+#define M_BIG 1000000000
+#define M_SEED 161803398
+
+typedef struct
+ {
+ unsigned int x;
+ unsigned int y;
+ unsigned long int buffer[56];
+ }
+ran3_state_t;
+
+static inline unsigned long int
+ran3_get (void *vstate)
+{
+ ran3_state_t *state = (ran3_state_t *) vstate;
+ long int j;
+
+ state->x++;
+
+ if (state->x == 56)
+ state->x = 1;
+
+ state->y++;
+
+ if (state->y == 56)
+ state->y = 1;
+
+ j = state->buffer[state->x] - state->buffer[state->y];
+
+ if (j < 0)
+ j += M_BIG;
+
+ state->buffer[state->x] = j;
+
+ return j;
+}
+
+static double
+ran3_get_double (void *vstate)
+{
+ return ran3_get (vstate) / (double) M_BIG ;
+}
+
+static void
+ran3_set (void *vstate, unsigned long int s)
+{
+ ran3_state_t *state = (ran3_state_t *) vstate;
+ int i, i1;
+ long int j, k;
+
+ if (s == 0)
+ s = 1; /* default seed is 1 */
+
+ j = (M_SEED - s) % M_BIG;
+
+ /* the zeroth element is never used, but we initialize it for
+ consistency between states */
+
+ state->buffer[0] = 0;
+
+ state->buffer[55] = j;
+
+ k = 1;
+ for (i = 1; i < 55; i++)
+ {
+ int n = (21 * i) % 55;
+ state->buffer[n] = k;
+ k = j - k;
+ if (k < 0)
+ k += M_BIG;
+ j = state->buffer[n];
+
+ }
+
+ for (i1 = 0; i1 < 4; i1++)
+ {
+ for (i = 1; i < 56; i++)
+ {
+ long int t = state->buffer[i] - state->buffer[1 + (i + 30) % 55];
+ if (t < 0)
+ t += M_BIG;
+ state->buffer[i] = t;
+ }
+ }
+
+ state->x = 0;
+ state->y = 31;
+
+ return;
+}
+
+static const gsl_rng_type ran3_type =
+{"ran3", /* name */
+ M_BIG, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (ran3_state_t),
+ &ran3_set,
+ &ran3_get,
+ &ran3_get_double};
+
+const gsl_rng_type *gsl_rng_ran3 = &ran3_type;
diff --git a/gsl-1.9/rng/rand.c b/gsl-1.9/rng/rand.c
new file mode 100644
index 0000000..4c50a62
--- /dev/null
+++ b/gsl-1.9/rng/rand.c
@@ -0,0 +1,85 @@
+/* rng/rand.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is the old BSD rand() generator. The sequence is
+
+ x_{n+1} = (a x_n + c) mod m
+
+ with a = 1103515245, c = 12345 and m = 2^31 = 2147483648. The seed
+ specifies the initial value, x_1.
+
+ The theoretical value of x_{10001} is 1910041713.
+
+ The period of this generator is 2^31.
+
+ The rand() generator is not very good -- the low bits of successive
+ numbers are correlated. */
+
+static inline unsigned long int rand_get (void *vstate);
+static double rand_get_double (void *vstate);
+static void rand_set (void *state, unsigned long int s);
+
+typedef struct
+ {
+ unsigned long int x;
+ }
+rand_state_t;
+
+static inline unsigned long int
+rand_get (void *vstate)
+{
+ rand_state_t *state = (rand_state_t *) vstate;
+
+ /* The following line relies on unsigned 32-bit arithmetic */
+
+ state->x = (1103515245 * state->x + 12345) & 0x7fffffffUL;
+
+ return state->x;
+}
+
+static double
+rand_get_double (void *vstate)
+{
+ return rand_get (vstate) / 2147483648.0 ;
+}
+
+static void
+rand_set (void *vstate, unsigned long int s)
+{
+ rand_state_t *state = (rand_state_t *) vstate;
+
+ state->x = s;
+
+ return;
+}
+
+static const gsl_rng_type rand_type =
+{"rand", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (rand_state_t),
+ &rand_set,
+ &rand_get,
+ &rand_get_double};
+
+const gsl_rng_type *gsl_rng_rand = &rand_type;
diff --git a/gsl-1.9/rng/rand48.c b/gsl-1.9/rng/rand48.c
new file mode 100644
index 0000000..f01a351
--- /dev/null
+++ b/gsl-1.9/rng/rand48.c
@@ -0,0 +1,143 @@
+/* rng/rand48.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <math.h>
+#include <stdlib.h>
+#include <gsl/gsl_sys.h>
+#include <gsl/gsl_rng.h>
+
+/* This is the Unix rand48() generator. The generator returns the
+ upper 32 bits from each term of the sequence,
+
+ x_{n+1} = (a x_n + c) mod m
+
+ using 48-bit unsigned arithmetic, with a = 0x5DEECE66D , c = 0xB
+ and m = 2^48. The seed specifies the upper 32 bits of the initial
+ value, x_1, with the lower 16 bits set to 0x330E.
+
+ The theoretical value of x_{10001} is 244131582646046.
+
+ The period of this generator is ? FIXME (probably around 2^48). */
+
+static inline void rand48_advance (void *vstate);
+static unsigned long int rand48_get (void *vstate);
+static double rand48_get_double (void *vstate);
+static void rand48_set (void *state, unsigned long int s);
+
+static const unsigned short int a0 = 0xE66D ;
+static const unsigned short int a1 = 0xDEEC ;
+static const unsigned short int a2 = 0x0005 ;
+
+static const unsigned short int c0 = 0x000B ;
+
+typedef struct
+ {
+ unsigned short int x0, x1, x2;
+ }
+rand48_state_t;
+
+static inline void
+rand48_advance (void *vstate)
+{
+ rand48_state_t *state = (rand48_state_t *) vstate;
+
+ /* work with unsigned long ints throughout to get correct integer
+ promotions of any unsigned short ints */
+
+ const unsigned long int x0 = (unsigned long int) state->x0 ;
+ const unsigned long int x1 = (unsigned long int) state->x1 ;
+ const unsigned long int x2 = (unsigned long int) state->x2 ;
+
+ unsigned long int a ;
+
+ a = a0 * x0 + c0 ;
+ state->x0 = (a & 0xFFFF) ;
+
+ a >>= 16 ;
+
+ /* although the next line may overflow we only need the top 16 bits
+ in the following stage, so it does not matter */
+
+ a += a0 * x1 + a1 * x0 ;
+ state->x1 = (a & 0xFFFF) ;
+
+ a >>= 16 ;
+ a += a0 * x2 + a1 * x1 + a2 * x0 ;
+ state->x2 = (a & 0xFFFF) ;
+}
+
+static unsigned long int
+rand48_get (void *vstate)
+{
+ unsigned long int x1, x2;
+
+ rand48_state_t *state = (rand48_state_t *) vstate;
+ rand48_advance (state) ;
+
+ x2 = (unsigned long int) state->x2;
+ x1 = (unsigned long int) state->x1;
+
+ return (x2 << 16) + x1;
+}
+
+static double
+rand48_get_double (void * vstate)
+{
+ rand48_state_t *state = (rand48_state_t *) vstate;
+
+ rand48_advance (state) ;
+
+ return (ldexp((double) state->x2, -16)
+ + ldexp((double) state->x1, -32)
+ + ldexp((double) state->x0, -48)) ;
+}
+
+static void
+rand48_set (void *vstate, unsigned long int s)
+{
+ rand48_state_t *state = (rand48_state_t *) vstate;
+
+ if (s == 0) /* default seed */
+ {
+ state->x0 = 0x330E ;
+ state->x1 = 0xABCD ;
+ state->x2 = 0x1234 ;
+ }
+ else
+ {
+ state->x0 = 0x330E ;
+ state->x1 = s & 0xFFFF ;
+ state->x2 = (s >> 16) & 0xFFFF ;
+ }
+
+ return;
+}
+
+static const gsl_rng_type rand48_type =
+{"rand48", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (rand48_state_t),
+ &rand48_set,
+ &rand48_get,
+ &rand48_get_double
+};
+
+const gsl_rng_type *gsl_rng_rand48 = &rand48_type;
diff --git a/gsl-1.9/rng/random.c b/gsl-1.9/rng/random.c
new file mode 100644
index 0000000..08697a9
--- /dev/null
+++ b/gsl-1.9/rng/random.c
@@ -0,0 +1,656 @@
+/* rng/random.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This file provides support for random() generators. There are three
+ versions in widespread use today,
+
+ - The original BSD version, e.g. on SunOS 4.1 and FreeBSD.
+
+ - The Linux libc5 version, which is differs from the BSD version in
+ its seeding procedure, possibly due to the introduction of a typo
+ in the multiplier.
+
+ - The GNU glibc2 version, which has a new (and better) seeding
+ procedure.
+
+ They all produce different numbers, due to the different seeding
+ algorithms, but the algorithm for the generator is the same in each
+ case.
+
+ */
+
+static inline long int random_get (int * i, int * j, int n, long int * x);
+
+static inline unsigned long int random8_get (void *vstate);
+static inline unsigned long int random32_get (void *vstate);
+static inline unsigned long int random64_get (void *vstate);
+static inline unsigned long int random128_get (void *vstate);
+static inline unsigned long int random256_get (void *vstate);
+
+static double random8_get_double (void *vstate);
+static double random32_get_double (void *vstate);
+static double random64_get_double (void *vstate);
+static double random128_get_double (void *vstate);
+static double random256_get_double (void *vstate);
+
+static void random8_glibc2_set (void *state, unsigned long int s);
+static void random32_glibc2_set (void *state, unsigned long int s);
+static void random64_glibc2_set (void *state, unsigned long int s);
+static void random128_glibc2_set (void *state, unsigned long int s);
+static void random256_glibc2_set (void *state, unsigned long int s);
+
+static void random8_libc5_set (void *state, unsigned long int s);
+static void random32_libc5_set (void *state, unsigned long int s);
+static void random64_libc5_set (void *state, unsigned long int s);
+static void random128_libc5_set (void *state, unsigned long int s);
+static void random256_libc5_set (void *state, unsigned long int s);
+
+static void random8_bsd_set (void *state, unsigned long int s);
+static void random32_bsd_set (void *state, unsigned long int s);
+static void random64_bsd_set (void *state, unsigned long int s);
+static void random128_bsd_set (void *state, unsigned long int s);
+static void random256_bsd_set (void *state, unsigned long int s);
+
+static void bsd_initialize (long int * x, int n, unsigned long int s);
+static void libc5_initialize (long int * x, int n, unsigned long int s);
+static void glibc2_initialize (long int * x, int n, unsigned long int s);
+
+typedef struct
+ {
+ long int x;
+ }
+random8_state_t;
+
+typedef struct
+ {
+ int i, j;
+ long int x[7];
+ }
+random32_state_t;
+
+typedef struct
+ {
+ int i, j;
+ long int x[15];
+ }
+random64_state_t;
+
+typedef struct
+ {
+ int i, j;
+ long int x[31];
+ }
+random128_state_t;
+
+typedef struct
+ {
+ int i, j;
+ long int x[63];
+ }
+random256_state_t;
+
+static inline unsigned long int
+random8_get (void *vstate)
+{
+ random8_state_t *state = (random8_state_t *) vstate;
+
+ state->x = (1103515245 * state->x + 12345) & 0x7fffffffUL;
+ return state->x;
+}
+
+static inline long int
+random_get (int * i, int * j, int n, long int * x)
+{
+ long int k ;
+
+ x[*i] += x[*j] ;
+ k = (x[*i] >> 1) & 0x7FFFFFFF ;
+
+ (*i)++ ;
+ if (*i == n)
+ *i = 0 ;
+
+ (*j)++ ;
+ if (*j == n)
+ *j = 0 ;
+
+ return k ;
+}
+
+static inline unsigned long int
+random32_get (void *vstate)
+{
+ random32_state_t *state = (random32_state_t *) vstate;
+ unsigned long int k = random_get (&state->i, &state->j, 7, state->x) ;
+ return k ;
+}
+
+static inline unsigned long int
+random64_get (void *vstate)
+{
+ random64_state_t *state = (random64_state_t *) vstate;
+ long int k = random_get (&state->i, &state->j, 15, state->x) ;
+ return k ;
+}
+
+static inline unsigned long int
+random128_get (void *vstate)
+{
+ random128_state_t *state = (random128_state_t *) vstate;
+ unsigned long int k = random_get (&state->i, &state->j, 31, state->x) ;
+ return k ;
+}
+
+static inline unsigned long int
+random256_get (void *vstate)
+{
+ random256_state_t *state = (random256_state_t *) vstate;
+ long int k = random_get (&state->i, &state->j, 63, state->x) ;
+ return k ;
+}
+
+static double
+random8_get_double (void *vstate)
+{
+ return random8_get (vstate) / 2147483648.0 ;
+}
+
+static double
+random32_get_double (void *vstate)
+{
+ return random32_get (vstate) / 2147483648.0 ;
+}
+
+static double
+random64_get_double (void *vstate)
+{
+ return random64_get (vstate) / 2147483648.0 ;
+}
+
+static double
+random128_get_double (void *vstate)
+{
+ return random128_get (vstate) / 2147483648.0 ;
+}
+
+static double
+random256_get_double (void *vstate)
+{
+ return random256_get (vstate) / 2147483648.0 ;
+}
+
+static void
+random8_bsd_set (void *vstate, unsigned long int s)
+{
+ random8_state_t *state = (random8_state_t *) vstate;
+
+ if (s == 0)
+ s = 1;
+
+ state->x = s;
+}
+
+static void
+random32_bsd_set (void *vstate, unsigned long int s)
+{
+ random32_state_t *state = (random32_state_t *) vstate;
+ int i;
+
+ bsd_initialize (state->x, 7, s) ;
+
+ state->i = 3;
+ state->j = 0;
+
+ for (i = 0 ; i < 10 * 7 ; i++)
+ random32_get (state) ;
+}
+
+static void
+random64_bsd_set (void *vstate, unsigned long int s)
+{
+ random64_state_t *state = (random64_state_t *) vstate;
+ int i;
+
+ bsd_initialize (state->x, 15, s) ;
+
+ state->i = 1;
+ state->j = 0;
+
+ for (i = 0 ; i < 10 * 15 ; i++)
+ random64_get (state) ;
+}
+
+static void
+random128_bsd_set (void *vstate, unsigned long int s)
+{
+ random128_state_t *state = (random128_state_t *) vstate;
+ int i;
+
+ bsd_initialize (state->x, 31, s) ;
+
+ state->i = 3;
+ state->j = 0;
+
+ for (i = 0 ; i < 10 * 31 ; i++)
+ random128_get (state) ;
+}
+
+static void
+random256_bsd_set (void *vstate, unsigned long int s)
+{
+ random256_state_t *state = (random256_state_t *) vstate;
+ int i;
+
+ bsd_initialize (state->x, 63, s) ;
+
+ state->i = 1;
+ state->j = 0;
+
+ for (i = 0 ; i < 10 * 63 ; i++)
+ random256_get (state) ;
+}
+
+static void
+bsd_initialize (long int * x, int n, unsigned long int s)
+{
+ int i;
+
+ if (s == 0)
+ s = 1 ;
+
+ x[0] = s;
+
+ for (i = 1 ; i < n ; i++)
+ x[i] = 1103515245 * x[i-1] + 12345 ;
+}
+
+static void
+libc5_initialize (long int * x, int n, unsigned long int s)
+{
+ int i;
+
+ if (s == 0)
+ s = 1 ;
+
+ x[0] = s;
+
+ for (i = 1 ; i < n ; i++)
+ x[i] = 1103515145 * x[i-1] + 12345 ;
+}
+
+static void
+glibc2_initialize (long int * x, int n, unsigned long int s)
+{
+ int i;
+
+ if (s == 0)
+ s = 1 ;
+
+ x[0] = s;
+
+ for (i = 1 ; i < n ; i++)
+ {
+ const long int h = s / 127773;
+ const long int t = 16807 * (s - h * 127773) - h * 2836;
+ if (t < 0)
+ {
+ s = t + 2147483647 ;
+ }
+ else
+ {
+ s = t ;
+ }
+
+ x[i] = s ;
+ }
+}
+
+static void
+random8_glibc2_set (void *vstate, unsigned long int s)
+{
+ random8_state_t *state = (random8_state_t *) vstate;
+
+ if (s == 0)
+ s = 1;
+
+ state->x = s;
+}
+
+static void
+random32_glibc2_set (void *vstate, unsigned long int s)
+{
+ random32_state_t *state = (random32_state_t *) vstate;
+ int i;
+
+ glibc2_initialize (state->x, 7, s) ;
+
+ state->i = 3;
+ state->j = 0;
+
+ for (i = 0 ; i < 10 * 7 ; i++)
+ random32_get (state) ;
+}
+
+static void
+random64_glibc2_set (void *vstate, unsigned long int s)
+{
+ random64_state_t *state = (random64_state_t *) vstate;
+ int i;
+
+ glibc2_initialize (state->x, 15, s) ;
+
+ state->i = 1;
+ state->j = 0;
+
+ for (i = 0 ; i < 10 * 15 ; i++)
+ random64_get (state) ;
+}
+
+static void
+random128_glibc2_set (void *vstate, unsigned long int s)
+{
+ random128_state_t *state = (random128_state_t *) vstate;
+ int i;
+
+ glibc2_initialize (state->x, 31, s) ;
+
+ state->i = 3;
+ state->j = 0;
+
+ for (i = 0 ; i < 10 * 31 ; i++)
+ random128_get (state) ;
+}
+
+static void
+random256_glibc2_set (void *vstate, unsigned long int s)
+{
+ random256_state_t *state = (random256_state_t *) vstate;
+ int i;
+
+ glibc2_initialize (state->x, 63, s) ;
+
+ state->i = 1;
+ state->j = 0;
+
+ for (i = 0 ; i < 10 * 63 ; i++)
+ random256_get (state) ;
+}
+
+
+static void
+random8_libc5_set (void *vstate, unsigned long int s)
+{
+ random8_state_t *state = (random8_state_t *) vstate;
+
+ if (s == 0)
+ s = 1;
+
+ state->x = s;
+}
+
+static void
+random32_libc5_set (void *vstate, unsigned long int s)
+{
+ random32_state_t *state = (random32_state_t *) vstate;
+ int i;
+
+ libc5_initialize (state->x, 7, s) ;
+
+ state->i = 3;
+ state->j = 0;
+
+ for (i = 0 ; i < 10 * 7 ; i++)
+ random32_get (state) ;
+}
+
+static void
+random64_libc5_set (void *vstate, unsigned long int s)
+{
+ random64_state_t *state = (random64_state_t *) vstate;
+ int i;
+
+ libc5_initialize (state->x, 15, s) ;
+
+ state->i = 1;
+ state->j = 0;
+
+ for (i = 0 ; i < 10 * 15 ; i++)
+ random64_get (state) ;
+}
+
+static void
+random128_libc5_set (void *vstate, unsigned long int s)
+{
+ random128_state_t *state = (random128_state_t *) vstate;
+ int i;
+
+ libc5_initialize (state->x, 31, s) ;
+
+ state->i = 3;
+ state->j = 0;
+
+ for (i = 0 ; i < 10 * 31 ; i++)
+ random128_get (state) ;
+}
+
+static void
+random256_libc5_set (void *vstate, unsigned long int s)
+{
+ random256_state_t *state = (random256_state_t *) vstate;
+ int i;
+
+ libc5_initialize (state->x, 63, s) ;
+
+ state->i = 1;
+ state->j = 0;
+
+ for (i = 0 ; i < 10 * 63 ; i++)
+ random256_get (state) ;
+}
+
+static const gsl_rng_type random_glibc2_type =
+{"random-glibc2", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random128_state_t),
+ &random128_glibc2_set,
+ &random128_get,
+ &random128_get_double};
+
+static const gsl_rng_type random8_glibc2_type =
+{"random8-glibc2", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random8_state_t),
+ &random8_glibc2_set,
+ &random8_get,
+ &random8_get_double};
+
+static const gsl_rng_type random32_glibc2_type =
+{"random32-glibc2", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random32_state_t),
+ &random32_glibc2_set,
+ &random32_get,
+ &random32_get_double};
+
+static const gsl_rng_type random64_glibc2_type =
+{"random64-glibc2", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random64_state_t),
+ &random64_glibc2_set,
+ &random64_get,
+ &random64_get_double};
+
+static const gsl_rng_type random128_glibc2_type =
+{"random128-glibc2", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random128_state_t),
+ &random128_glibc2_set,
+ &random128_get,
+ &random128_get_double};
+
+static const gsl_rng_type random256_glibc2_type =
+{"random256-glibc2", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random256_state_t),
+ &random256_glibc2_set,
+ &random256_get,
+ &random256_get_double};
+
+static const gsl_rng_type random_libc5_type =
+{"random-libc5", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random128_state_t),
+ &random128_libc5_set,
+ &random128_get,
+ &random128_get_double};
+
+static const gsl_rng_type random8_libc5_type =
+{"random8-libc5", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random8_state_t),
+ &random8_libc5_set,
+ &random8_get,
+ &random8_get_double};
+
+static const gsl_rng_type random32_libc5_type =
+{"random32-libc5", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random32_state_t),
+ &random32_libc5_set,
+ &random32_get,
+ &random32_get_double};
+
+static const gsl_rng_type random64_libc5_type =
+{"random64-libc5", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random64_state_t),
+ &random64_libc5_set,
+ &random64_get,
+ &random64_get_double};
+
+static const gsl_rng_type random128_libc5_type =
+{"random128-libc5", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random128_state_t),
+ &random128_libc5_set,
+ &random128_get,
+ &random128_get_double};
+
+static const gsl_rng_type random256_libc5_type =
+{"random256-libc5", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random256_state_t),
+ &random256_libc5_set,
+ &random256_get,
+ &random256_get_double};
+
+static const gsl_rng_type random_bsd_type =
+{"random-bsd", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random128_state_t),
+ &random128_bsd_set,
+ &random128_get,
+ &random128_get_double};
+
+static const gsl_rng_type random8_bsd_type =
+{"random8-bsd", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random8_state_t),
+ &random8_bsd_set,
+ &random8_get,
+ &random8_get_double};
+
+static const gsl_rng_type random32_bsd_type =
+{"random32-bsd", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random32_state_t),
+ &random32_bsd_set,
+ &random32_get,
+ &random32_get_double};
+
+static const gsl_rng_type random64_bsd_type =
+{"random64-bsd", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random64_state_t),
+ &random64_bsd_set,
+ &random64_get,
+ &random64_get_double};
+
+static const gsl_rng_type random128_bsd_type =
+{"random128-bsd", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random128_state_t),
+ &random128_bsd_set,
+ &random128_get,
+ &random128_get_double};
+
+static const gsl_rng_type random256_bsd_type =
+{"random256-bsd", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (random256_state_t),
+ &random256_bsd_set,
+ &random256_get,
+ &random256_get_double};
+
+const gsl_rng_type *gsl_rng_random_libc5 = &random_libc5_type;
+const gsl_rng_type *gsl_rng_random8_libc5 = &random8_libc5_type;
+const gsl_rng_type *gsl_rng_random32_libc5 = &random32_libc5_type;
+const gsl_rng_type *gsl_rng_random64_libc5 = &random64_libc5_type;
+const gsl_rng_type *gsl_rng_random128_libc5 = &random128_libc5_type;
+const gsl_rng_type *gsl_rng_random256_libc5 = &random256_libc5_type;
+
+const gsl_rng_type *gsl_rng_random_glibc2 = &random_glibc2_type;
+const gsl_rng_type *gsl_rng_random8_glibc2 = &random8_glibc2_type;
+const gsl_rng_type *gsl_rng_random32_glibc2 = &random32_glibc2_type;
+const gsl_rng_type *gsl_rng_random64_glibc2 = &random64_glibc2_type;
+const gsl_rng_type *gsl_rng_random128_glibc2 = &random128_glibc2_type;
+const gsl_rng_type *gsl_rng_random256_glibc2 = &random256_glibc2_type;
+
+const gsl_rng_type *gsl_rng_random_bsd = &random_bsd_type;
+const gsl_rng_type *gsl_rng_random8_bsd = &random8_bsd_type;
+const gsl_rng_type *gsl_rng_random32_bsd = &random32_bsd_type;
+const gsl_rng_type *gsl_rng_random64_bsd = &random64_bsd_type;
+const gsl_rng_type *gsl_rng_random128_bsd = &random128_bsd_type;
+const gsl_rng_type *gsl_rng_random256_bsd = &random256_bsd_type;
+
+
+
+
diff --git a/gsl-1.9/rng/randu.c b/gsl-1.9/rng/randu.c
new file mode 100644
index 0000000..acd9ea1
--- /dev/null
+++ b/gsl-1.9/rng/randu.c
@@ -0,0 +1,95 @@
+/* rng/randu.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is a reincarnation of the infamously bad RANDU generator.
+ The sequence is,
+
+ x_{n+1} = (a x_n) mod m
+
+ with a = 65539 and m = 2^31 = 2147483648. The seed specifies
+ the initial value, x_1.
+
+ The theoretical value of x_{10001} is 1623524161.
+
+ The period of this generator is 2^29.
+
+ Note: Knuth describes this generator as "really horrible".
+
+ From: Park and Miller, "Random Number Generators: Good ones are
+ hard to find" Communications of the ACM, October 1988, Volume 31,
+ No 10, pages 1192-1201. */
+
+static inline unsigned long int randu_get (void *vstate);
+static double randu_get_double (void *vstate);
+static void randu_set (void *state, unsigned long int s);
+
+static const long int a = 65539;
+/* static const unsigned long int m = 2147483648UL; */
+
+typedef struct
+ {
+ unsigned long int x;
+ }
+randu_state_t;
+
+static inline unsigned long int
+randu_get (void *vstate)
+{
+ randu_state_t *state = (randu_state_t *) vstate;
+
+ /* The following line relies on unsigned 32-bit arithmetic */
+
+ state->x = (a * state->x) & 0x7fffffffUL;
+
+ return state->x;
+}
+
+static double
+randu_get_double (void *vstate)
+{
+ return randu_get (vstate) / 2147483648.0 ;
+}
+
+static void
+randu_set (void *vstate, unsigned long int s)
+{
+ randu_state_t *state = (randu_state_t *) vstate;
+
+ if (s == 0)
+ s = 1; /* default seed is 1 */
+
+ state->x = s;
+
+ return;
+}
+
+static const gsl_rng_type randu_type =
+{"randu", /* name */
+ 0x7fffffffUL, /* RAND_MAX */
+ 1, /* RAND_MIN */
+ sizeof (randu_state_t),
+ &randu_set,
+ &randu_get,
+ &randu_get_double};
+
+const gsl_rng_type *gsl_rng_randu = &randu_type;
diff --git a/gsl-1.9/rng/ranf.c b/gsl-1.9/rng/ranf.c
new file mode 100644
index 0000000..cc5ac41
--- /dev/null
+++ b/gsl-1.9/rng/ranf.c
@@ -0,0 +1,161 @@
+/* rng/ranf.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <math.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is the CRAY RANF generator. The generator returns the
+ upper 32 bits from each term of the sequence,
+
+ x_{n+1} = (a x_n) mod m
+
+ using 48-bit unsigned arithmetic, with a = 0x2875A2E7B175 and m =
+ 2^48. The seed specifies the lower 32 bits of the initial value,
+ x_1, with the lowest bit set (to prevent the seed taking an even
+ value), and the upper 16 bits set to 0.
+
+ There is a subtlety in the implementation of the seed. The initial
+ state is put one step back by multiplying by the modular inverse of
+ a mod m. This is done for compatibility with the original CRAY
+ implementation.
+
+ Note, you can only seed the generator with integers up to 2^32,
+ while the CRAY uses wide integers which can cover all 2^48 states
+ of the generator.
+
+ The theoretical value of x_{10001} is 141091827447341.
+
+ The period of this generator is 2^{46}. */
+
+static inline void ranf_advance (void *vstate);
+static unsigned long int ranf_get (void *vstate);
+static double ranf_get_double (void *vstate);
+static void ranf_set (void *state, unsigned long int s);
+
+static const unsigned short int a0 = 0xB175 ;
+static const unsigned short int a1 = 0xA2E7 ;
+static const unsigned short int a2 = 0x2875 ;
+
+typedef struct
+ {
+ unsigned short int x0, x1, x2;
+ }
+ranf_state_t;
+
+static inline void
+ranf_advance (void *vstate)
+{
+ ranf_state_t *state = (ranf_state_t *) vstate;
+
+ const unsigned long int x0 = (unsigned long int) state->x0 ;
+ const unsigned long int x1 = (unsigned long int) state->x1 ;
+ const unsigned long int x2 = (unsigned long int) state->x2 ;
+
+ unsigned long int r ;
+
+ r = a0 * x0 ;
+ state->x0 = (r & 0xFFFF) ;
+
+ r >>= 16 ;
+ r += a0 * x1 + a1 * x0 ;
+ state->x1 = (r & 0xFFFF) ;
+
+ r >>= 16 ;
+ r += a0 * x2 + a1 * x1 + a2 * x0 ;
+ state->x2 = (r & 0xFFFF) ;
+}
+
+static unsigned long int
+ranf_get (void *vstate)
+{
+ unsigned long int x1, x2;
+
+ ranf_state_t *state = (ranf_state_t *) vstate;
+ ranf_advance (state) ;
+
+ x1 = (unsigned long int) state->x1;
+ x2 = (unsigned long int) state->x2;
+
+ return (x2 << 16) + x1;
+}
+
+static double
+ranf_get_double (void * vstate)
+{
+ ranf_state_t *state = (ranf_state_t *) vstate;
+
+ ranf_advance (state) ;
+
+ return (ldexp((double) state->x2, -16)
+ + ldexp((double) state->x1, -32)
+ + ldexp((double) state->x0, -48)) ;
+}
+
+static void
+ranf_set (void *vstate, unsigned long int s)
+{
+ ranf_state_t *state = (ranf_state_t *) vstate;
+
+ unsigned short int x0, x1, x2 ;
+ unsigned long int r ;
+
+ unsigned long int b0 = 0xD6DD ;
+ unsigned long int b1 = 0xB894 ;
+ unsigned long int b2 = 0x5CEE ;
+
+ if (s == 0) /* default seed */
+ {
+ x0 = 0x9CD1 ;
+ x1 = 0x53FC ;
+ x2 = 0x9482 ;
+ }
+ else
+ {
+ x0 = (s | 1) & 0xFFFF ;
+ x1 = s >> 16 & 0xFFFF ;
+ x2 = 0 ;
+ }
+
+ r = b0 * x0 ;
+ state->x0 = (r & 0xFFFF) ;
+
+ r >>= 16 ;
+ r += b0 * x1 + b1 * x0 ;
+ state->x1 = (r & 0xFFFF) ;
+
+ r >>= 16 ;
+ r += b0 * x2 + b1 * x1 + b2 * x0 ;
+ state->x2 = (r & 0xFFFF) ;
+
+ return;
+}
+
+static const gsl_rng_type ranf_type =
+{"ranf", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (ranf_state_t),
+ &ranf_set,
+ &ranf_get,
+ &ranf_get_double
+};
+
+const gsl_rng_type *gsl_rng_ranf = &ranf_type;
diff --git a/gsl-1.9/rng/ranlux.c b/gsl-1.9/rng/ranlux.c
new file mode 100644
index 0000000..b5e681d
--- /dev/null
+++ b/gsl-1.9/rng/ranlux.c
@@ -0,0 +1,222 @@
+/* rng/ranlux.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is a lagged fibonacci generator with skipping developed by Luescher.
+ The sequence is a series of 24-bit integers, x_n,
+
+ x_n = d_n + b_n
+
+ where d_n = x_{n-10} - x_{n-24} - c_{n-1}, b_n = 0 if d_n >= 0 and
+ b_n = 2^24 if d_n < 0, c_n = 0 if d_n >= 0 and c_n = 1 if d_n < 0,
+ where after 24 samples a group of p integers are "skipped", to
+ reduce correlations. By default p = 199, but can be increased to
+ 365.
+
+ The period of the generator is around 10^171.
+
+ From: M. Luescher, "A portable high-quality random number generator
+ for lattice field theory calculations", Computer Physics
+ Communications, 79 (1994) 100-110.
+
+ Available on the net as hep-lat/9309020 at http://xxx.lanl.gov/
+
+ See also,
+
+ F. James, "RANLUX: A Fortran implementation of the high-quality
+ pseudo-random number generator of Luscher", Computer Physics
+ Communications, 79 (1994) 111-114
+
+ Kenneth G. Hamilton, F. James, "Acceleration of RANLUX", Computer
+ Physics Communications, 101 (1997) 241-248
+
+ Kenneth G. Hamilton, "Assembler RANLUX for PCs", Computer Physics
+ Communications, 101 (1997) 249-253 */
+
+static inline unsigned long int ranlux_get (void *vstate);
+static double ranlux_get_double (void *vstate);
+static void ranlux_set_lux (void *state, unsigned long int s, unsigned int luxury);
+static void ranlux_set (void *state, unsigned long int s);
+static void ranlux389_set (void *state, unsigned long int s);
+
+static const unsigned long int mask_lo = 0x00ffffffUL; /* 2^24 - 1 */
+static const unsigned long int mask_hi = ~0x00ffffffUL;
+static const unsigned long int two24 = 16777216; /* 2^24 */
+
+typedef struct
+ {
+ unsigned int i;
+ unsigned int j;
+ unsigned int n;
+ unsigned int skip;
+ unsigned int carry;
+ unsigned long int u[24];
+ }
+ranlux_state_t;
+
+static inline unsigned long int increment_state (ranlux_state_t * state);
+
+static inline unsigned long int
+increment_state (ranlux_state_t * state)
+{
+ unsigned int i = state->i;
+ unsigned int j = state->j;
+ long int delta = state->u[j] - state->u[i] - state->carry;
+
+ if (delta & mask_hi)
+ {
+ state->carry = 1;
+ delta &= mask_lo;
+ }
+ else
+ {
+ state->carry = 0;
+ }
+
+ state->u[i] = delta;
+
+ if (i == 0)
+ {
+ i = 23;
+ }
+ else
+ {
+ i--;
+ }
+
+ state->i = i;
+
+ if (j == 0)
+ {
+ j = 23;
+ }
+ else
+ {
+ j--;
+ }
+
+ state->j = j;
+
+ return delta;
+}
+
+static inline unsigned long int
+ranlux_get (void *vstate)
+{
+ ranlux_state_t *state = (ranlux_state_t *) vstate;
+ const unsigned int skip = state->skip;
+ unsigned long int r = increment_state (state);
+
+ state->n++;
+
+ if (state->n == 24)
+ {
+ unsigned int i;
+ state->n = 0;
+ for (i = 0; i < skip; i++)
+ increment_state (state);
+ }
+
+ return r;
+}
+
+static double
+ranlux_get_double (void *vstate)
+{
+ return ranlux_get (vstate) / 16777216.0;
+}
+
+static void
+ranlux_set_lux (void *vstate, unsigned long int s, unsigned int luxury)
+{
+ ranlux_state_t *state = (ranlux_state_t *) vstate;
+ int i;
+
+ long int seed;
+
+ if (s == 0)
+ s = 314159265; /* default seed is 314159265 */
+
+ seed = s;
+
+ /* This is the initialization algorithm of F. James, widely in use
+ for RANLUX. */
+
+ for (i = 0; i < 24; i++)
+ {
+ unsigned long int k = seed / 53668;
+ seed = 40014 * (seed - k * 53668) - k * 12211;
+ if (seed < 0)
+ {
+ seed += 2147483563;
+ }
+ state->u[i] = seed % two24;
+ }
+
+ state->i = 23;
+ state->j = 9;
+ state->n = 0;
+ state->skip = luxury - 24;
+
+ if (state->u[23] & mask_hi)
+ {
+ state->carry = 1;
+ }
+ else
+ {
+ state->carry = 0;
+ }
+}
+
+static void
+ranlux_set (void *vstate, unsigned long int s)
+{
+ ranlux_set_lux (vstate, s, 223);
+}
+
+static void
+ranlux389_set (void *vstate, unsigned long int s)
+{
+ ranlux_set_lux (vstate, s, 389);
+}
+
+
+static const gsl_rng_type ranlux_type =
+{"ranlux", /* name */
+ 0x00ffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (ranlux_state_t),
+ &ranlux_set,
+ &ranlux_get,
+ &ranlux_get_double};
+
+static const gsl_rng_type ranlux389_type =
+{"ranlux389", /* name */
+ 0x00ffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (ranlux_state_t),
+ &ranlux389_set,
+ &ranlux_get,
+ &ranlux_get_double};
+
+const gsl_rng_type *gsl_rng_ranlux = &ranlux_type;
+const gsl_rng_type *gsl_rng_ranlux389 = &ranlux389_type;
diff --git a/gsl-1.9/rng/ranlxd.c b/gsl-1.9/rng/ranlxd.c
new file mode 100644
index 0000000..a7f3b0e
--- /dev/null
+++ b/gsl-1.9/rng/ranlxd.c
@@ -0,0 +1,249 @@
+/* rng/ranlxd.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is an implementation of Martin Luescher's second generation
+ double-precision (48-bit) version of the RANLUX generator.
+
+ Thanks to Martin Luescher for providing information on this
+ generator.
+
+*/
+
+static inline unsigned long int ranlxd_get (void *vstate);
+static double ranlxd_get_double (void *vstate);
+static void ranlxd_set_lux (void *state, unsigned long int s, unsigned int luxury);
+static void ranlxd1_set (void *state, unsigned long int s);
+static void ranlxd2_set (void *state, unsigned long int s);
+
+static const int next[12] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0};
+
+static const double one_bit = 1.0 / 281474976710656.0; /* 1/2^48 */
+
+#define RANLUX_STEP(x1,x2,i1,i2,i3) \
+ x1=xdbl[i1] - xdbl[i2]; \
+ if (x2 < 0) \
+ { \
+ x1-=one_bit; \
+ x2+=1; \
+ } \
+ xdbl[i3]=x2
+
+typedef struct
+ {
+ double xdbl[12];
+ double carry;
+ unsigned int ir;
+ unsigned int jr;
+ unsigned int ir_old;
+ unsigned int pr;
+ }
+ranlxd_state_t;
+
+static inline void increment_state (ranlxd_state_t * state);
+
+static inline void
+increment_state (ranlxd_state_t * state)
+{
+ int k, kmax;
+ double y1, y2, y3;
+
+ double *xdbl = state->xdbl;
+ double carry = state->carry;
+ unsigned int ir = state->ir;
+ unsigned int jr = state->jr;
+
+ for (k = 0; ir > 0; ++k)
+ {
+ y1 = xdbl[jr] - xdbl[ir];
+ y2 = y1 - carry;
+ if (y2 < 0)
+ {
+ carry = one_bit;
+ y2 += 1;
+ }
+ else
+ {
+ carry = 0;
+ }
+ xdbl[ir] = y2;
+ ir = next[ir];
+ jr = next[jr];
+ }
+
+ kmax = state->pr - 12;
+
+ for (; k <= kmax; k += 12)
+ {
+ y1 = xdbl[7] - xdbl[0];
+ y1 -= carry;
+
+ RANLUX_STEP (y2, y1, 8, 1, 0);
+ RANLUX_STEP (y3, y2, 9, 2, 1);
+ RANLUX_STEP (y1, y3, 10, 3, 2);
+ RANLUX_STEP (y2, y1, 11, 4, 3);
+ RANLUX_STEP (y3, y2, 0, 5, 4);
+ RANLUX_STEP (y1, y3, 1, 6, 5);
+ RANLUX_STEP (y2, y1, 2, 7, 6);
+ RANLUX_STEP (y3, y2, 3, 8, 7);
+ RANLUX_STEP (y1, y3, 4, 9, 8);
+ RANLUX_STEP (y2, y1, 5, 10, 9);
+ RANLUX_STEP (y3, y2, 6, 11, 10);
+
+ if (y3 < 0)
+ {
+ carry = one_bit;
+ y3 += 1;
+ }
+ else
+ {
+ carry = 0;
+ }
+ xdbl[11] = y3;
+ }
+
+ kmax = state->pr;
+
+ for (; k < kmax; ++k)
+ {
+ y1 = xdbl[jr] - xdbl[ir];
+ y2 = y1 - carry;
+ if (y2 < 0)
+ {
+ carry = one_bit;
+ y2 += 1;
+ }
+ else
+ {
+ carry = 0;
+ }
+ xdbl[ir] = y2;
+ ir = next[ir];
+ jr = next[jr];
+ }
+ state->ir = ir;
+ state->ir_old = ir;
+ state->jr = jr;
+ state->carry = carry;
+}
+
+static inline unsigned long int
+ranlxd_get (void *vstate)
+{
+ return ranlxd_get_double (vstate) * 4294967296.0; /* 2^32 */
+}
+
+static double
+ranlxd_get_double (void *vstate)
+{
+ ranlxd_state_t *state = (ranlxd_state_t *) vstate;
+
+ int ir = state->ir;
+
+ state->ir = next[ir];
+
+ if (state->ir == state->ir_old)
+ increment_state (state);
+
+ return state->xdbl[state->ir];
+}
+
+static void
+ranlxd_set_lux (void *vstate, unsigned long int s, unsigned int luxury)
+{
+ ranlxd_state_t *state = (ranlxd_state_t *) vstate;
+
+ int ibit, jbit, i, k, l, xbit[31];
+ double x, y;
+
+ long int seed;
+
+ if (s == 0)
+ s = 1; /* default seed is 1 */
+
+ seed = s;
+
+ i = seed & 0xFFFFFFFFUL;
+
+ for (k = 0; k < 31; ++k)
+ {
+ xbit[k] = i % 2;
+ i /= 2;
+ }
+
+ ibit = 0;
+ jbit = 18;
+
+ for (k = 0; k < 12; ++k)
+ {
+ x = 0;
+
+ for (l = 1; l <= 48; ++l)
+ {
+ y = (double) ((xbit[ibit] + 1) % 2);
+ x += x + y;
+ xbit[ibit] = (xbit[ibit] + xbit[jbit]) % 2;
+ ibit = (ibit + 1) % 31;
+ jbit = (jbit + 1) % 31;
+ }
+ state->xdbl[k] = one_bit * x;
+ }
+
+ state->carry = 0;
+ state->ir = 11;
+ state->jr = 7;
+ state->ir_old = 0;
+ state->pr = luxury;
+}
+
+static void
+ranlxd1_set (void *vstate, unsigned long int s)
+{
+ ranlxd_set_lux (vstate, s, 202);
+}
+
+static void
+ranlxd2_set (void *vstate, unsigned long int s)
+{
+ ranlxd_set_lux (vstate, s, 397);
+}
+
+static const gsl_rng_type ranlxd1_type =
+{"ranlxd1", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (ranlxd_state_t),
+ &ranlxd1_set,
+ &ranlxd_get,
+ &ranlxd_get_double};
+
+static const gsl_rng_type ranlxd2_type =
+{"ranlxd2", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (ranlxd_state_t),
+ &ranlxd2_set,
+ &ranlxd_get,
+ &ranlxd_get_double};
+
+const gsl_rng_type *gsl_rng_ranlxd1 = &ranlxd1_type;
+const gsl_rng_type *gsl_rng_ranlxd2 = &ranlxd2_type;
diff --git a/gsl-1.9/rng/ranlxs.c b/gsl-1.9/rng/ranlxs.c
new file mode 100644
index 0000000..923aa39
--- /dev/null
+++ b/gsl-1.9/rng/ranlxs.c
@@ -0,0 +1,302 @@
+/* rng/ranlxs.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is an implementation of M. Luescher's second generation
+ version of the RANLUX generator.
+
+ Thanks to Martin Luescher for providing information on this
+ generator.
+
+ */
+
+static unsigned long int ranlxs_get (void *vstate);
+static inline double ranlxs_get_double (void *vstate);
+static void ranlxs_set_lux (void *state, unsigned long int s, unsigned int luxury);
+static void ranlxs0_set (void *state, unsigned long int s);
+static void ranlxs1_set (void *state, unsigned long int s);
+static void ranlxs2_set (void *state, unsigned long int s);
+
+static const int next[12] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0};
+static const int snext[24] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0};
+
+static const double sbase = 16777216.0; /* 2^24 */
+static const double sone_bit = 1.0 / 16777216.0; /* 1/2^24 */
+static const double one_bit = 1.0 / 281474976710656.0; /* 1/2^48 */
+
+static const double shift = 268435456.0; /* 2^28 */
+
+#define RANLUX_STEP(x1,x2,i1,i2,i3) \
+ x1=xdbl[i1] - xdbl[i2]; \
+ if (x2 < 0) \
+ { \
+ x1-=one_bit; \
+ x2+=1; \
+ } \
+ xdbl[i3]=x2
+
+typedef struct
+ {
+ double xdbl[12], ydbl[12]; /* doubles first so they are 8-byte aligned */
+ double carry;
+ float xflt[24];
+ unsigned int ir;
+ unsigned int jr;
+ unsigned int is;
+ unsigned int is_old;
+ unsigned int pr;
+ }
+ranlxs_state_t;
+
+static void increment_state (ranlxs_state_t * state);
+
+static void
+increment_state (ranlxs_state_t * state)
+{
+ int k, kmax, m;
+ double x, y1, y2, y3;
+
+ float *xflt = state->xflt;
+ double *xdbl = state->xdbl;
+ double *ydbl = state->ydbl;
+ double carry = state->carry;
+ unsigned int ir = state->ir;
+ unsigned int jr = state->jr;
+
+ for (k = 0; ir > 0; ++k)
+ {
+ y1 = xdbl[jr] - xdbl[ir];
+ y2 = y1 - carry;
+ if (y2 < 0)
+ {
+ carry = one_bit;
+ y2 += 1;
+ }
+ else
+ {
+ carry = 0;
+ }
+ xdbl[ir] = y2;
+ ir = next[ir];
+ jr = next[jr];
+ }
+
+ kmax = state->pr - 12;
+
+ for (; k <= kmax; k += 12)
+ {
+ y1 = xdbl[7] - xdbl[0];
+ y1 -= carry;
+
+ RANLUX_STEP (y2, y1, 8, 1, 0);
+ RANLUX_STEP (y3, y2, 9, 2, 1);
+ RANLUX_STEP (y1, y3, 10, 3, 2);
+ RANLUX_STEP (y2, y1, 11, 4, 3);
+ RANLUX_STEP (y3, y2, 0, 5, 4);
+ RANLUX_STEP (y1, y3, 1, 6, 5);
+ RANLUX_STEP (y2, y1, 2, 7, 6);
+ RANLUX_STEP (y3, y2, 3, 8, 7);
+ RANLUX_STEP (y1, y3, 4, 9, 8);
+ RANLUX_STEP (y2, y1, 5, 10, 9);
+ RANLUX_STEP (y3, y2, 6, 11, 10);
+
+ if (y3 < 0)
+ {
+ carry = one_bit;
+ y3 += 1;
+ }
+ else
+ {
+ carry = 0;
+ }
+ xdbl[11] = y3;
+ }
+
+ kmax = state->pr;
+
+ for (; k < kmax; ++k)
+ {
+ y1 = xdbl[jr] - xdbl[ir];
+ y2 = y1 - carry;
+ if (y2 < 0)
+ {
+ carry = one_bit;
+ y2 += 1;
+ }
+ else
+ {
+ carry = 0;
+ }
+ xdbl[ir] = y2;
+ ydbl[ir] = y2 + shift;
+ ir = next[ir];
+ jr = next[jr];
+ }
+
+ ydbl[ir] = xdbl[ir] + shift;
+
+ for (k = next[ir]; k > 0;)
+ {
+ ydbl[k] = xdbl[k] + shift;
+ k = next[k];
+ }
+
+ for (k = 0, m = 0; k < 12; ++k)
+ {
+ x = xdbl[k];
+ y2 = ydbl[k] - shift;
+ if (y2 > x)
+ y2 -= sone_bit;
+ y1 = (x - y2) * sbase;
+
+ xflt[m++] = (float) y1;
+ xflt[m++] = (float) y2;
+ }
+
+ state->ir = ir;
+ state->is = 2 * ir;
+ state->is_old = 2 * ir;
+ state->jr = jr;
+ state->carry = carry;
+}
+
+
+static inline double
+ranlxs_get_double (void *vstate)
+{
+ ranlxs_state_t *state = (ranlxs_state_t *) vstate;
+
+ const unsigned int is = snext[state->is];
+
+ state->is = is;
+
+ if (is == state->is_old)
+ increment_state (state);
+
+ return state->xflt[state->is];
+}
+
+static unsigned long int
+ranlxs_get (void *vstate)
+{
+ return ranlxs_get_double (vstate) * 16777216.0; /* 2^24 */
+}
+
+static void
+ranlxs_set_lux (void *vstate, unsigned long int s, unsigned int luxury)
+{
+ ranlxs_state_t *state = (ranlxs_state_t *) vstate;
+
+ int ibit, jbit, i, k, m, xbit[31];
+ double x, y;
+
+ long int seed;
+
+ if (s == 0)
+ s = 1; /* default seed is 1 */
+
+ seed = s;
+
+ i = seed & 0xFFFFFFFFUL;
+
+ for (k = 0; k < 31; ++k)
+ {
+ xbit[k] = i % 2;
+ i /= 2;
+ }
+
+ ibit = 0;
+ jbit = 18;
+
+ for (k = 0; k < 12; ++k)
+ {
+ x = 0;
+
+ for (m = 1; m <= 48; ++m)
+ {
+ y = (double) xbit[ibit];
+ x += x + y;
+ xbit[ibit] = (xbit[ibit] + xbit[jbit]) % 2;
+ ibit = (ibit + 1) % 31;
+ jbit = (jbit + 1) % 31;
+ }
+ state->xdbl[k] = one_bit * x;
+ }
+
+ state->carry = 0;
+ state->ir = 0;
+ state->jr = 7;
+ state->is = 23;
+ state->is_old = 0;
+ state->pr = luxury;
+}
+
+static void
+ranlxs0_set (void *vstate, unsigned long int s)
+{
+ ranlxs_set_lux (vstate, s, 109);
+}
+
+void
+ranlxs1_set (void *vstate, unsigned long int s)
+{
+ ranlxs_set_lux (vstate, s, 202);
+}
+
+static void
+ranlxs2_set (void *vstate, unsigned long int s)
+{
+ ranlxs_set_lux (vstate, s, 397);
+}
+
+
+static const gsl_rng_type ranlxs0_type =
+{"ranlxs0", /* name */
+ 0x00ffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (ranlxs_state_t),
+ &ranlxs0_set,
+ &ranlxs_get,
+ &ranlxs_get_double};
+
+static const gsl_rng_type ranlxs1_type =
+{"ranlxs1", /* name */
+ 0x00ffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (ranlxs_state_t),
+ &ranlxs1_set,
+ &ranlxs_get,
+ &ranlxs_get_double};
+
+static const gsl_rng_type ranlxs2_type =
+{"ranlxs2", /* name */
+ 0x00ffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (ranlxs_state_t),
+ &ranlxs2_set,
+ &ranlxs_get,
+ &ranlxs_get_double};
+
+const gsl_rng_type *gsl_rng_ranlxs0 = &ranlxs0_type;
+const gsl_rng_type *gsl_rng_ranlxs1 = &ranlxs1_type;
+const gsl_rng_type *gsl_rng_ranlxs2 = &ranlxs2_type;
diff --git a/gsl-1.9/rng/ranmar.c b/gsl-1.9/rng/ranmar.c
new file mode 100644
index 0000000..fd53cb5
--- /dev/null
+++ b/gsl-1.9/rng/ranmar.c
@@ -0,0 +1,173 @@
+/* rng/ranmar.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is the RANMAR lagged fibonacci generator of Marsaglia, Zaman
+ and Tsang. The sequence is a series of 24-bit integers, x_n,
+
+ x_n = (y_n - c_n + 2^24) mod 2^24
+
+ where,
+
+ y_n = (y_{n-97) - y_{n-33} + 2^24) mod 2^24
+ c_n = (c_{n-1} - 7654321 + 2^24 - 3) mod (2^24 - 3)
+
+ The period of this generator is 2^144.
+
+ The generator provides about 900 million different subsequences
+ each of length O(10^30). Thus each seed up to 900,000,000 gives an
+ independent sequence.
+
+ Although it was good in its day this generator now has known
+ statistical defects and has been superseded by RANLUX.
+
+ From: F. James, "A Review of Pseudorandom number generators",
+ Computer Physics Communications 60, 329 (1990).
+
+ G. Marsaglia, A. Zaman and W.W. Tsang, Stat. Prob. Lett. 9, 35 (1990) */
+
+static inline unsigned long int ranmar_get (void *vstate);
+static double ranmar_get_double (void *vstate);
+static void ranmar_set (void *state, unsigned long int s);
+
+static const unsigned long int two24 = 16777216; /* 2^24 */
+
+typedef struct
+ {
+ unsigned int i;
+ unsigned int j;
+ long int carry;
+ unsigned long int u[97];
+ }
+ranmar_state_t;
+
+static inline unsigned long int
+ranmar_get (void *vstate)
+{
+ ranmar_state_t *state = (ranmar_state_t *) vstate;
+
+ unsigned int i = state->i;
+ unsigned int j = state->j;
+ long int carry = state->carry;
+
+ long int delta = state->u[i] - state->u[j];
+
+ if (delta < 0)
+ delta += two24 ;
+
+ state->u[i] = delta;
+
+ if (i == 0)
+ {
+ i = 96;
+ }
+ else
+ {
+ i--;
+ }
+
+ state->i = i;
+
+ if (j == 0)
+ {
+ j = 96;
+ }
+ else
+ {
+ j--;
+ }
+
+ state->j = j;
+
+ carry += - 7654321 ;
+
+ if (carry < 0)
+ carry += two24 - 3;
+
+ state->carry = carry ;
+
+ delta += - carry ;
+
+ if (delta < 0)
+ delta += two24 ;
+
+ return delta;
+}
+
+static double
+ranmar_get_double (void *vstate)
+{
+ return ranmar_get (vstate) / 16777216.0 ;
+}
+
+static void
+ranmar_set (void *vstate, unsigned long int s)
+{
+ ranmar_state_t *state = (ranmar_state_t *) vstate;
+
+ unsigned long int ij = s / 30082 ;
+ unsigned long int kl = s % 30082 ;
+
+ int i = (ij / 177) % 177 + 2 ;
+ int j = (ij % 177) + 2 ;
+ int k = (kl / 169) % 178 + 1 ;
+ int l = (kl % 169) ;
+
+ int a, b;
+
+ for (a = 0; a < 97; a++)
+ {
+ unsigned long int sum = 0 ;
+ unsigned long int t = two24 ;
+
+ for (b = 0; b < 24; b++)
+ {
+ unsigned long int m = (((i * j) % 179) * k) % 179 ;
+ i = j ;
+ j = k ;
+ k = m ;
+ l = (53 * l + 1) % 169 ;
+ t >>= 1 ;
+
+ if ((l * m) % 64 >= 32)
+ sum += t ;
+ }
+
+ state->u[a] = sum ;
+ }
+
+ state->i = 96;
+ state->j = 32;
+ state->carry = 362436 ;
+
+}
+
+static const gsl_rng_type ranmar_type =
+{"ranmar", /* name */
+ 0x00ffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (ranmar_state_t),
+ &ranmar_set,
+ &ranmar_get,
+ &ranmar_get_double};
+
+const gsl_rng_type *gsl_rng_ranmar = &ranmar_type;
diff --git a/gsl-1.9/rng/rng.c b/gsl-1.9/rng/rng.c
new file mode 100644
index 0000000..eafdefb
--- /dev/null
+++ b/gsl-1.9/rng/rng.c
@@ -0,0 +1,211 @@
+/* rng/rng.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <gsl/gsl_errno.h>
+#include <gsl/gsl_rng.h>
+
+gsl_rng *
+gsl_rng_alloc (const gsl_rng_type * T)
+{
+
+ gsl_rng *r = (gsl_rng *) malloc (sizeof (gsl_rng));
+
+ if (r == 0)
+ {
+ GSL_ERROR_VAL ("failed to allocate space for rng struct",
+ GSL_ENOMEM, 0);
+ };
+
+ r->state = malloc (T->size);
+
+ if (r->state == 0)
+ {
+ free (r); /* exception in constructor, avoid memory leak */
+
+ GSL_ERROR_VAL ("failed to allocate space for rng state",
+ GSL_ENOMEM, 0);
+ };
+
+ r->type = T;
+
+ gsl_rng_set (r, gsl_rng_default_seed); /* seed the generator */
+
+ return r;
+}
+
+int
+gsl_rng_memcpy (gsl_rng * dest, const gsl_rng * src)
+{
+ if (dest->type != src->type)
+ {
+ GSL_ERROR ("generators must be of the same type", GSL_EINVAL);
+ }
+
+ memcpy (dest->state, src->state, src->type->size);
+
+ return GSL_SUCCESS;
+}
+
+gsl_rng *
+gsl_rng_clone (const gsl_rng * q)
+{
+ gsl_rng *r = (gsl_rng *) malloc (sizeof (gsl_rng));
+
+ if (r == 0)
+ {
+ GSL_ERROR_VAL ("failed to allocate space for rng struct",
+ GSL_ENOMEM, 0);
+ };
+
+ r->state = malloc (q->type->size);
+
+ if (r->state == 0)
+ {
+ free (r); /* exception in constructor, avoid memory leak */
+
+ GSL_ERROR_VAL ("failed to allocate space for rng state",
+ GSL_ENOMEM, 0);
+ };
+
+ r->type = q->type;
+
+ memcpy (r->state, q->state, q->type->size);
+
+ return r;
+}
+
+void
+gsl_rng_set (const gsl_rng * r, unsigned long int seed)
+{
+ (r->type->set) (r->state, seed);
+}
+
+#ifndef HIDE_INLINE_STATIC
+unsigned long int
+gsl_rng_get (const gsl_rng * r)
+{
+ return (r->type->get) (r->state);
+}
+
+double
+gsl_rng_uniform (const gsl_rng * r)
+{
+ return (r->type->get_double) (r->state);
+}
+
+double
+gsl_rng_uniform_pos (const gsl_rng * r)
+{
+ double x ;
+ do
+ {
+ x = (r->type->get_double) (r->state) ;
+ }
+ while (x == 0) ;
+
+ return x ;
+}
+
+/* Note: to avoid integer overflow in (range+1) we work with scale =
+ range/n = (max-min)/n rather than scale=(max-min+1)/n, this reduces
+ efficiency slightly but avoids having to check for the out of range
+ value. Note that range is typically O(2^32) so the addition of 1
+ is negligible in most usage. */
+
+unsigned long int
+gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n)
+{
+ unsigned long int offset = r->type->min;
+ unsigned long int range = r->type->max - offset;
+ unsigned long int scale;
+ unsigned long int k;
+
+ if (n > range || n == 0)
+ {
+ GSL_ERROR_VAL ("invalid n, either 0 or exceeds maximum value of generator",
+ GSL_EINVAL, 0) ;
+ }
+
+ scale = range / n;
+
+ do
+ {
+ k = (((r->type->get) (r->state)) - offset) / scale;
+ }
+ while (k >= n);
+
+ return k;
+}
+#endif
+
+unsigned long int
+gsl_rng_max (const gsl_rng * r)
+{
+ return r->type->max;
+}
+
+unsigned long int
+gsl_rng_min (const gsl_rng * r)
+{
+ return r->type->min;
+}
+
+const char *
+gsl_rng_name (const gsl_rng * r)
+{
+ return r->type->name;
+}
+
+size_t
+gsl_rng_size (const gsl_rng * r)
+{
+ return r->type->size;
+}
+
+void *
+gsl_rng_state (const gsl_rng * r)
+{
+ return r->state;
+}
+
+void
+gsl_rng_print_state (const gsl_rng * r)
+{
+ size_t i;
+ unsigned char *p = (unsigned char *) (r->state);
+ const size_t n = r->type->size;
+
+ for (i = 0; i < n; i++)
+ {
+ /* FIXME: we're assuming that a char is 8 bits */
+ printf ("%.2x", *(p + i));
+ }
+
+}
+
+void
+gsl_rng_free (gsl_rng * r)
+{
+ free (r->state);
+ free (r);
+}
diff --git a/gsl-1.9/rng/schrage.c b/gsl-1.9/rng/schrage.c
new file mode 100644
index 0000000..413ff78
--- /dev/null
+++ b/gsl-1.9/rng/schrage.c
@@ -0,0 +1,51 @@
+/* rng/schrage.c
+ * Copyright (C) 2003 Carlo Perassi and Heiko Bauke.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+static inline unsigned long int
+schrage (unsigned long int a, unsigned long int b, unsigned long int m)
+{
+ /* This is a modified version of Schrage's method. It ensures that no
+ * overflow or underflow occurs even if a=ceil(sqrt(m)). Usual
+ * Schrage's method works only until a=floor(sqrt(m)).
+ */
+ unsigned long int q, t;
+ if (a == 0UL)
+ return 0UL;
+ q = m / a;
+ t = 2 * m - (m % a) * (b / q);
+ if (t >= m)
+ t -= m;
+ t += a * (b % q);
+ return (t >= m) ? (t - m) : t;
+}
+
+static inline unsigned long int
+schrage_mult (unsigned long int a, unsigned long int b,
+ unsigned long int m,
+ unsigned long int sqrtm)
+{
+ /* To multiply a and b use Schrage's method 3 times.
+ * represent a in base ceil(sqrt(m)) a = a1*ceil(sqrt(m)) + a0
+ * a*b = (a1*ceil(sqrt(m)) + a0)*b = a1*ceil(sqrt(m))*b + a0*b
+ */
+ unsigned long int t0 = schrage (sqrtm, b, m);
+ unsigned long int t1 = schrage (a / sqrtm, t0, m);
+ unsigned long int t2 = schrage (a % sqrtm, b, m);
+ unsigned long int t = t1 + t2;
+ return (t >= m) ? (t - m) : t;
+}
diff --git a/gsl-1.9/rng/slatec.c b/gsl-1.9/rng/slatec.c
new file mode 100644
index 0000000..57e9ffb
--- /dev/null
+++ b/gsl-1.9/rng/slatec.c
@@ -0,0 +1,205 @@
+/* rng/slatec.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/**
+
+* ======================================================================
+* NIST Guide to Available Math Software.
+* Source for module RAND from package CMLIB.
+* Retrieved from TIBER on Fri Oct 11 11:43:42 1996.
+* ======================================================================
+ FUNCTION RAND(R)
+C***BEGIN PROLOGUE RAND
+C***DATE WRITTEN 770401 (YYMMDD)
+C***REVISION DATE 820801 (YYMMDD)
+C***CATEGORY NO. L6A21
+C***KEYWORDS RANDOM NUMBER,SPECIAL FUNCTION,UNIFORM
+C***AUTHOR FULLERTON, W., (LANL)
+C***PURPOSE Generates a uniformly distributed random number.
+C***DESCRIPTION
+C
+C This pseudo-random number generator is portable among a wide
+C variety of computers. RAND(R) undoubtedly is not as good as many
+C readily available installation dependent versions, and so this
+C routine is not recommended for widespread usage. Its redeeming
+C feature is that the exact same random numbers (to within final round-
+C off error) can be generated from machine to machine. Thus, programs
+C that make use of random numbers can be easily transported to and
+C checked in a new environment.
+C The random numbers are generated by the linear congruential
+C method described, e.g., by Knuth in Seminumerical Methods (p.9),
+C Addison-Wesley, 1969. Given the I-th number of a pseudo-random
+C sequence, the I+1 -st number is generated from
+C X(I+1) = (A*X(I) + C) MOD M,
+C where here M = 2**22 = 4194304, C = 1731 and several suitable values
+C of the multiplier A are discussed below. Both the multiplier A and
+C random number X are represented in double precision as two 11-bit
+C words. The constants are chosen so that the period is the maximum
+C possible, 4194304.
+C In order that the same numbers be generated from machine to
+C machine, it is necessary that 23-bit integers be reducible modulo
+C 2**11 exactly, that 23-bit integers be added exactly, and that 11-bit
+C integers be multiplied exactly. Furthermore, if the restart option
+C is used (where R is between 0 and 1), then the product R*2**22 =
+C R*4194304 must be correct to the nearest integer.
+C The first four random numbers should be .0004127026,
+C .6750836372, .1614754200, and .9086198807. The tenth random number
+C is .5527787209, and the hundredth is .3600893021 . The thousandth
+C number should be .2176990509 .
+C In order to generate several effectively independent sequences
+C with the same generator, it is necessary to know the random number
+C for several widely spaced calls. The I-th random number times 2**22,
+C where I=K*P/8 and P is the period of the sequence (P = 2**22), is
+C still of the form L*P/8. In particular we find the I-th random
+C number multiplied by 2**22 is given by
+C I = 0 1*P/8 2*P/8 3*P/8 4*P/8 5*P/8 6*P/8 7*P/8 8*P/8
+C RAND= 0 5*P/8 2*P/8 7*P/8 4*P/8 1*P/8 6*P/8 3*P/8 0
+C Thus the 4*P/8 = 2097152 random number is 2097152/2**22.
+C Several multipliers have been subjected to the spectral test
+C (see Knuth, p. 82). Four suitable multipliers roughly in order of
+C goodness according to the spectral test are
+C 3146757 = 1536*2048 + 1029 = 2**21 + 2**20 + 2**10 + 5
+C 2098181 = 1024*2048 + 1029 = 2**21 + 2**10 + 5
+C 3146245 = 1536*2048 + 517 = 2**21 + 2**20 + 2**9 + 5
+C 2776669 = 1355*2048 + 1629 = 5**9 + 7**7 + 1
+C
+C In the table below LOG10(NU(I)) gives roughly the number of
+C random decimal digits in the random numbers considered I at a time.
+C C is the primary measure of goodness. In both cases bigger is better.
+C
+C LOG10 NU(I) C(I)
+C A I=2 I=3 I=4 I=5 I=2 I=3 I=4 I=5
+C
+C 3146757 3.3 2.0 1.6 1.3 3.1 1.3 4.6 2.6
+C 2098181 3.3 2.0 1.6 1.2 3.2 1.3 4.6 1.7
+C 3146245 3.3 2.2 1.5 1.1 3.2 4.2 1.1 0.4
+C 2776669 3.3 2.1 1.6 1.3 2.5 2.0 1.9 2.6
+C Best
+C Possible 3.3 2.3 1.7 1.4 3.6 5.9 9.7 14.9
+C
+C Input Argument --
+C R If R=0., the next random number of the sequence is generated.
+C If R .LT. 0., the last generated number will be returned for
+C possible use in a restart procedure.
+C If R .GT. 0., the sequence of random numbers will start with
+C the seed R mod 1. This seed is also returned as the value of
+C RAND provided the arithmetic is done exactly.
+C
+C Output Value --
+C RAND a pseudo-random number between 0. and 1.
+C***REFERENCES (NONE)
+C***ROUTINES CALLED (NONE)
+C***END PROLOGUE RAND
+ DATA IA1, IA0, IA1MA0 /1536, 1029, 507/
+ DATA IC /1731/
+ DATA IX1, IX0 /0, 0/
+C***FIRST EXECUTABLE STATEMENT RAND
+ IF (R.LT.0.) GO TO 10
+ IF (R.GT.0.) GO TO 20
+C
+C A*X = 2**22*IA1*IX1 + 2**11*(IA1*IX1 + (IA1-IA0)*(IX0-IX1)
+C + IA0*IX0) + IA0*IX0
+C
+ IY0 = IA0*IX0
+ IY1 = IA1*IX1 + IA1MA0*(IX0-IX1) + IY0
+ IY0 = IY0 + IC
+ IX0 = MOD (IY0, 2048)
+ IY1 = IY1 + (IY0-IX0)/2048
+ IX1 = MOD (IY1, 2048)
+C
+ 10 RAND = IX1*2048 + IX0
+ RAND = RAND / 4194304.
+ RETURN
+C
+ 20 IX1 = AMOD(R,1.)*4194304. + 0.5
+ IX0 = MOD (IX1, 2048)
+ IX1 = (IX1-IX0)/2048
+ GO TO 10
+C
+ END
+
+ **/
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+static inline unsigned long int slatec_get (void *vstate);
+static double slatec_get_double (void *vstate);
+static void slatec_set (void *state, unsigned long int s);
+
+typedef struct
+ {
+ long int x0, x1;
+ }
+slatec_state_t;
+
+static const long P = 4194304;
+static const long a1 = 1536;
+static const long a0 = 1029;
+static const long a1ma0 = 507;
+static const long c = 1731;
+
+static inline unsigned long int
+slatec_get (void *vstate)
+{
+ long y0, y1;
+ slatec_state_t *state = (slatec_state_t *) vstate;
+
+ y0 = a0 * state->x0;
+ y1 = a1 * state->x1 + a1ma0 * (state->x0 - state->x1) + y0;
+ y0 = y0 + c;
+ state->x0 = y0 % 2048;
+ y1 = y1 + (y0 - state->x0) / 2048;
+ state->x1 = y1 % 2048;
+
+ return state->x1 * 2048 + state->x0;
+}
+
+static double
+slatec_get_double (void *vstate)
+{
+ return slatec_get (vstate) / 4194304.0 ;
+}
+
+static void
+slatec_set (void *vstate, unsigned long int s)
+{
+ slatec_state_t *state = (slatec_state_t *) vstate;
+
+ /* Only eight seeds are permitted. This is pretty limiting, but
+ at least we are guaranteed that the eight sequences are different */
+
+ s = s % 8;
+ s *= P / 8;
+
+ state->x0 = s % 2048;
+ state->x1 = (s - state->x0) / 2048;
+}
+
+static const gsl_rng_type slatec_type =
+{"slatec", /* name */
+ 4194303, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (slatec_state_t),
+ &slatec_set,
+ &slatec_get,
+ &slatec_get_double};
+
+const gsl_rng_type *gsl_rng_slatec = &slatec_type;
diff --git a/gsl-1.9/rng/taus.c b/gsl-1.9/rng/taus.c
new file mode 100644
index 0000000..fd039f5
--- /dev/null
+++ b/gsl-1.9/rng/taus.c
@@ -0,0 +1,184 @@
+/* rng/taus.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is a maximally equidistributed combined Tausworthe
+ generator. The sequence is,
+
+ x_n = (s1_n ^ s2_n ^ s3_n)
+
+ s1_{n+1} = (((s1_n & 4294967294) <<12) ^ (((s1_n <<13) ^ s1_n) >>19))
+ s2_{n+1} = (((s2_n & 4294967288) << 4) ^ (((s2_n << 2) ^ s2_n) >>25))
+ s3_{n+1} = (((s3_n & 4294967280) <<17) ^ (((s3_n << 3) ^ s3_n) >>11))
+
+ computed modulo 2^32. In the three formulas above '^' means
+ exclusive-or (C-notation), not exponentiation. Note that the
+ algorithm relies on the properties of 32-bit unsigned integers (it
+ is formally defined on bit-vectors of length 32). I have added a
+ bitmask to make it work on 64 bit machines.
+
+ We initialize the generator with s1_1 .. s3_1 = s_n MOD m, where
+ s_n = (69069 * s_{n-1}) mod 2^32, and s_0 = s is the user-supplied
+ seed.
+
+ The theoretical value of x_{10007} is 2733957125. The subscript
+ 10007 means (1) seed the generator with s=1 (2) do six warm-up
+ iterations, (3) then do 10000 actual iterations.
+
+ The period of this generator is about 2^88.
+
+ From: P. L'Ecuyer, "Maximally Equidistributed Combined Tausworthe
+ Generators", Mathematics of Computation, 65, 213 (1996), 203--213.
+
+ This is available on the net from L'Ecuyer's home page,
+
+ http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme.ps
+ ftp://ftp.iro.umontreal.ca/pub/simulation/lecuyer/papers/tausme.ps
+
+ Update: April 2002
+
+ There is an erratum in the paper "Tables of Maximally
+ Equidistributed Combined LFSR Generators", Mathematics of
+ Computation, 68, 225 (1999), 261--269:
+ http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme2.ps
+
+ ... the k_j most significant bits of z_j must be non-
+ zero, for each j. (Note: this restriction also applies to the
+ computer code given in [4], but was mistakenly not mentioned in
+ that paper.)
+
+ This affects the seeding procedure by imposing the requirement
+ s1 > 1, s2 > 7, s3 > 15.
+
+ The generator taus2 has been added to satisfy this requirement.
+ The original taus generator is unchanged.
+
+ Update: November 2002
+
+ There was a bug in the correction to the seeding procedure for s2.
+ It affected the following seeds 254679140 1264751179 1519430319
+ 2274823218 2529502358 3284895257 3539574397 (s2 < 8).
+
+*/
+
+static inline unsigned long int taus_get (void *vstate);
+static double taus_get_double (void *vstate);
+static void taus_set (void *state, unsigned long int s);
+
+typedef struct
+ {
+ unsigned long int s1, s2, s3;
+ }
+taus_state_t;
+
+static inline unsigned long
+taus_get (void *vstate)
+{
+ taus_state_t *state = (taus_state_t *) vstate;
+
+#define MASK 0xffffffffUL
+#define TAUSWORTHE(s,a,b,c,d) (((s &c) <<d) &MASK) ^ ((((s <<a) &MASK)^s) >>b)
+
+ state->s1 = TAUSWORTHE (state->s1, 13, 19, 4294967294UL, 12);
+ state->s2 = TAUSWORTHE (state->s2, 2, 25, 4294967288UL, 4);
+ state->s3 = TAUSWORTHE (state->s3, 3, 11, 4294967280UL, 17);
+
+ return (state->s1 ^ state->s2 ^ state->s3);
+}
+
+static double
+taus_get_double (void *vstate)
+{
+ return taus_get (vstate) / 4294967296.0 ;
+}
+
+static void
+taus_set (void *vstate, unsigned long int s)
+{
+ taus_state_t *state = (taus_state_t *) vstate;
+
+ if (s == 0)
+ s = 1; /* default seed is 1 */
+
+#define LCG(n) ((69069 * n) & 0xffffffffUL)
+ state->s1 = LCG (s);
+ state->s2 = LCG (state->s1);
+ state->s3 = LCG (state->s2);
+
+ /* "warm it up" */
+ taus_get (state);
+ taus_get (state);
+ taus_get (state);
+ taus_get (state);
+ taus_get (state);
+ taus_get (state);
+ return;
+}
+
+static void
+taus2_set (void *vstate, unsigned long int s)
+{
+ taus_state_t *state = (taus_state_t *) vstate;
+
+ if (s == 0)
+ s = 1; /* default seed is 1 */
+
+#define LCG(n) ((69069 * n) & 0xffffffffUL)
+ state->s1 = LCG (s);
+ if (state->s1 < 2) state->s1 += 2UL;
+ state->s2 = LCG (state->s1);
+ if (state->s2 < 8) state->s2 += 8UL;
+ state->s3 = LCG (state->s2);
+ if (state->s3 < 16) state->s3 += 16UL;
+
+ /* "warm it up" */
+ taus_get (state);
+ taus_get (state);
+ taus_get (state);
+ taus_get (state);
+ taus_get (state);
+ taus_get (state);
+ return;
+}
+
+
+static const gsl_rng_type taus_type =
+{"taus", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (taus_state_t),
+ &taus_set,
+ &taus_get,
+ &taus_get_double};
+
+const gsl_rng_type *gsl_rng_taus = &taus_type;
+
+static const gsl_rng_type taus2_type =
+{"taus2", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (taus_state_t),
+ &taus2_set,
+ &taus_get,
+ &taus_get_double};
+
+const gsl_rng_type *gsl_rng_taus2 = &taus2_type;
diff --git a/gsl-1.9/rng/taus113.c b/gsl-1.9/rng/taus113.c
new file mode 100644
index 0000000..68cfc9e
--- /dev/null
+++ b/gsl-1.9/rng/taus113.c
@@ -0,0 +1,168 @@
+/* rng/taus113.c
+ * Copyright (C) 2002 Atakan Gurkan
+ * Based on the file taus.c which has the notice
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/* This is a maximally equidistributed combined, collision free
+ Tausworthe generator, with a period ~2^{113}. The sequence is,
+
+ x_n = (z1_n ^ z2_n ^ z3_n ^ z4_n)
+
+ b = (((z1_n << 6) ^ z1_n) >> 13)
+ z1_{n+1} = (((z1_n & 4294967294) << 18) ^ b)
+ b = (((z2_n << 2) ^ z2_n) >> 27)
+ z2_{n+1} = (((z2_n & 4294967288) << 2) ^ b)
+ b = (((z3_n << 13) ^ z3_n) >> 21)
+ z3_{n+1} = (((z3_n & 4294967280) << 7) ^ b)
+ b = (((z4_n << 3) ^ z4_n) >> 12)
+ z4_{n+1} = (((z4_n & 4294967168) << 13) ^ b)
+
+ computed modulo 2^32. In the formulas above '^' means exclusive-or
+ (C-notation), not exponentiation.
+ The algorithm is for 32-bit integers, hence a bitmask is used to clear
+ all but least significant 32 bits, after left shifts, to make the code
+ work on architectures where integers are 64-bit.
+
+ The generator is initialized with
+ zi = (69069 * z{i+1}) MOD 2^32 where z0 is the seed provided
+ During initialization a check is done to make sure that the initial seeds
+ have a required number of their most significant bits set.
+ After this, the state is passed through the RNG 10 times to ensure the
+ state satisfies a recurrence relation.
+
+ References:
+ P. L'Ecuyer, "Tables of Maximally-Equidistributed Combined LFSR Generators",
+ Mathematics of Computation, 68, 225 (1999), 261--269.
+ http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme2.ps
+ P. L'Ecuyer, "Maximally Equidistributed Combined Tausworthe Generators",
+ Mathematics of Computation, 65, 213 (1996), 203--213.
+ http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme.ps
+ the online version of the latter contains corrections to the print version.
+*/
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+#define LCG(n) ((69069UL * n) & 0xffffffffUL)
+#define MASK 0xffffffffUL
+
+static inline unsigned long int taus113_get (void *vstate);
+static double taus113_get_double (void *vstate);
+static void taus113_set (void *state, unsigned long int s);
+
+typedef struct
+{
+ unsigned long int z1, z2, z3, z4;
+}
+taus113_state_t;
+
+static inline unsigned long
+taus113_get (void *vstate)
+{
+ taus113_state_t *state = (taus113_state_t *) vstate;
+ unsigned long b1, b2, b3, b4;
+
+ b1 = ((((state->z1 << 6UL) & MASK) ^ state->z1) >> 13UL);
+ state->z1 = ((((state->z1 & 4294967294UL) << 18UL) & MASK) ^ b1);
+
+ b2 = ((((state->z2 << 2UL) & MASK) ^ state->z2) >> 27UL);
+ state->z2 = ((((state->z2 & 4294967288UL) << 2UL) & MASK) ^ b2);
+
+ b3 = ((((state->z3 << 13UL) & MASK) ^ state->z3) >> 21UL);
+ state->z3 = ((((state->z3 & 4294967280UL) << 7UL) & MASK) ^ b3);
+
+ b4 = ((((state->z4 << 3UL) & MASK) ^ state->z4) >> 12UL);
+ state->z4 = ((((state->z4 & 4294967168UL) << 13UL) & MASK) ^ b4);
+
+ return (state->z1 ^ state->z2 ^ state->z3 ^ state->z4);
+
+}
+
+static double
+taus113_get_double (void *vstate)
+{
+ return taus113_get (vstate) / 4294967296.0;
+}
+
+static void
+taus113_set (void *vstate, unsigned long int s)
+{
+ taus113_state_t *state = (taus113_state_t *) vstate;
+
+ if (!s)
+ s = 1UL; /* default seed is 1 */
+
+ state->z1 = LCG (s);
+ if (state->z1 < 2UL)
+ state->z1 += 2UL;
+ state->z2 = LCG (state->z1);
+ if (state->z2 < 8UL)
+ state->z2 += 8UL;
+ state->z3 = LCG (state->z2);
+ if (state->z3 < 16UL)
+ state->z3 += 16UL;
+ state->z4 = LCG (state->z3);
+ if (state->z4 < 128UL)
+ state->z4 += 128UL;
+
+ /* Calling RNG ten times to satify recurrence condition */
+ taus113_get (state);
+ taus113_get (state);
+ taus113_get (state);
+ taus113_get (state);
+ taus113_get (state);
+ taus113_get (state);
+ taus113_get (state);
+ taus113_get (state);
+ taus113_get (state);
+ taus113_get (state);
+
+ return;
+}
+
+static const gsl_rng_type taus113_type = {
+ "taus113", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (taus113_state_t),
+ &taus113_set,
+ &taus113_get,
+ &taus113_get_double
+};
+
+const gsl_rng_type *gsl_rng_taus113 = &taus113_type;
+
+
+/* Rules for analytic calculations using GNU Emacs Calc:
+ (used to find the values for the test program)
+
+ [ LCG(n) := n * 69069 mod (2^32) ]
+
+ [ b1(x) := rsh(xor(lsh(x, 6), x), 13),
+ q1(x) := xor(lsh(and(x, 4294967294), 18), b1(x)),
+ b2(x) := rsh(xor(lsh(x, 2), x), 27),
+ q2(x) := xor(lsh(and(x, 4294967288), 2), b2(x)),
+ b3(x) := rsh(xor(lsh(x, 13), x), 21),
+ q3(x) := xor(lsh(and(x, 4294967280), 7), b3(x)),
+ b4(x) := rsh(xor(lsh(x, 3), x), 12),
+ q4(x) := xor(lsh(and(x, 4294967168), 13), b4(x))
+ ]
+
+ [ S([z1,z2,z3,z4]) := [q1(z1), q2(z2), q3(z3), q4(z4)] ]
+*/
diff --git a/gsl-1.9/rng/test.c b/gsl-1.9/rng/test.c
new file mode 100644
index 0000000..8b267a2
--- /dev/null
+++ b/gsl-1.9/rng/test.c
@@ -0,0 +1,602 @@
+/* rng/test.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <gsl/gsl_rng.h>
+#include <gsl/gsl_test.h>
+#include <gsl/gsl_ieee_utils.h>
+
+void rng_test (const gsl_rng_type * T, unsigned long int seed, unsigned int n,
+ unsigned long int result);
+void rng_float_test (const gsl_rng_type * T);
+void generic_rng_test (const gsl_rng_type * T);
+void rng_state_test (const gsl_rng_type * T);
+void rng_parallel_state_test (const gsl_rng_type * T);
+void rng_read_write_test (const gsl_rng_type * T);
+int rng_max_test (gsl_rng * r, unsigned long int *kmax, unsigned long int ran_max) ;
+int rng_min_test (gsl_rng * r, unsigned long int *kmin, unsigned long int ran_min, unsigned long int ran_max) ;
+int rng_sum_test (gsl_rng * r, double *sigma);
+int rng_bin_test (gsl_rng * r, double *sigma);
+
+#define N 10000
+#define N2 200000
+
+int
+main (void)
+{
+ const gsl_rng_type ** rngs = gsl_rng_types_setup(); /* get all rng types */
+
+ const gsl_rng_type ** r ;
+
+ gsl_ieee_env_setup ();
+
+ gsl_rng_env_setup ();
+
+ /* specific tests of known results for 10000 iterations with seed = 1 */
+
+ rng_test (gsl_rng_rand, 1, 10000, 1910041713);
+ rng_test (gsl_rng_randu, 1, 10000, 1623524161);
+ rng_test (gsl_rng_cmrg, 1, 10000, 719452880);
+ rng_test (gsl_rng_minstd, 1, 10000, 1043618065);
+ rng_test (gsl_rng_mrg, 1, 10000, 2064828650);
+ rng_test (gsl_rng_taus, 1, 10000, 2733957125UL);
+ rng_test (gsl_rng_taus2, 1, 10000, 2733957125UL);
+ rng_test (gsl_rng_taus113, 1, 1000, 1925420673UL);
+ rng_test (gsl_rng_transputer, 1, 10000, 1244127297UL);
+ rng_test (gsl_rng_vax, 1, 10000, 3051034865UL);
+
+ /* Borosh13 test value from PARI: (1812433253^10000)%(2^32) */
+ rng_test (gsl_rng_borosh13, 1, 10000, 2513433025UL);
+
+ /* Fishman18 test value from PARI: (62089911^10000)%(2^31-1) */
+ rng_test (gsl_rng_fishman18, 1, 10000, 330402013UL);
+
+ /* Fishman2x test value from PARI:
+ ((48271^10000)%(2^31-1) - (40692^10000)%(2^31-249))%(2^31-1) */
+ rng_test (gsl_rng_fishman2x, 1, 10000, 540133597UL);
+
+ /* Knuthran2 test value from PARI:
+ { xn1=1; xn2=1; for (n=1,10000,
+ xn = (271828183*xn1 - 314159269*xn2)%(2^31-1);
+ xn2=xn1; xn1=xn; print(xn); ) } */
+ rng_test (gsl_rng_knuthran2, 1, 10000, 1084477620UL);
+
+ /* Knuthran test value taken from p188 in Knuth Vol 2. 3rd Ed */
+ rng_test (gsl_rng_knuthran, 310952, 1009 * 2009 + 1, 461390032);
+
+ /* Knuthran improved test value from Knuth's source */
+ rng_test (gsl_rng_knuthran2002, 310952, 1, 708622036);
+ rng_test (gsl_rng_knuthran2002, 310952, 2, 1005450560);
+ rng_test (gsl_rng_knuthran2002, 310952, 100 * 2009 + 1, 995235265);
+ rng_test (gsl_rng_knuthran2002, 310952, 1009 * 2009 + 1, 704987132);
+
+ /* Lecuyer21 test value from PARI: (40692^10000)%(2^31-249) */
+ rng_test (gsl_rng_lecuyer21, 1, 10000, 2006618587UL);
+
+ /* Waterman14 test value from PARI: (1566083941^10000)%(2^32) */
+ rng_test (gsl_rng_waterman14, 1, 10000, 3776680385UL);
+
+ /* specific tests of known results for 10000 iterations with seed = 6 */
+
+ /* Coveyou test value from PARI:
+ x=6; for(n=1,10000,x=(x*(x+1))%(2^32);print(x);) */
+
+ rng_test (gsl_rng_coveyou, 6, 10000, 1416754246UL);
+
+ /* Fishman20 test value from PARI: (6*48271^10000)%(2^31-1) */
+ rng_test (gsl_rng_fishman20, 6, 10000, 248127575UL);
+
+ /* FIXME: the ranlux tests below were made by running the fortran code and
+ getting the expected value from that. An analytic calculation
+ would be preferable. */
+
+ rng_test (gsl_rng_ranlux, 314159265, 10000, 12077992);
+ rng_test (gsl_rng_ranlux389, 314159265, 10000, 165942);
+
+ rng_test (gsl_rng_ranlxs0, 1, 10000, 11904320);
+ /* 0.709552764892578125 * ldexp(1.0,24) */
+
+ rng_test (gsl_rng_ranlxs1, 1, 10000, 8734328);
+ /* 0.520606517791748047 * ldexp(1.0,24) */
+
+ rng_test (gsl_rng_ranlxs2, 1, 10000, 6843140);
+ /* 0.407882928848266602 * ldexp(1.0,24) */
+
+ rng_test (gsl_rng_ranlxd1, 1, 10000, 1998227290UL);
+ /* 0.465248546261094020 * ldexp(1.0,32) */
+
+ rng_test (gsl_rng_ranlxd2, 1, 10000, 3949287736UL);
+ /* 0.919515205581550532 * ldexp(1.0,32) */
+
+ /* FIXME: the tests below were made by running the original code in
+ the ../random directory and getting the expected value from
+ that. An analytic calculation would be preferable. */
+
+ rng_test (gsl_rng_slatec, 1, 10000, 45776);
+ rng_test (gsl_rng_uni, 1, 10000, 9214);
+ rng_test (gsl_rng_uni32, 1, 10000, 1155229825);
+ rng_test (gsl_rng_zuf, 1, 10000, 3970);
+
+ /* The tests below were made by running the original code and
+ getting the expected value from that. An analytic calculation
+ would be preferable. */
+
+ rng_test (gsl_rng_r250, 1, 10000, 1100653588);
+ rng_test (gsl_rng_mt19937, 4357, 1000, 1186927261);
+ rng_test (gsl_rng_mt19937_1999, 4357, 1000, 1030650439);
+ rng_test (gsl_rng_mt19937_1998, 4357, 1000, 1309179303);
+ rng_test (gsl_rng_tt800, 0, 10000, 2856609219UL);
+
+ rng_test (gsl_rng_ran0, 0, 10000, 1115320064);
+ rng_test (gsl_rng_ran1, 0, 10000, 1491066076);
+ rng_test (gsl_rng_ran2, 0, 10000, 1701364455);
+ rng_test (gsl_rng_ran3, 0, 10000, 186340785);
+
+ rng_test (gsl_rng_ranmar, 1, 10000, 14428370);
+
+ rng_test (gsl_rng_rand48, 0, 10000, 0xDE095043UL);
+ rng_test (gsl_rng_rand48, 1, 10000, 0xEDA54977UL);
+
+ rng_test (gsl_rng_random_glibc2, 0, 10000, 1908609430);
+ rng_test (gsl_rng_random8_glibc2, 0, 10000, 1910041713);
+ rng_test (gsl_rng_random32_glibc2, 0, 10000, 1587395585);
+ rng_test (gsl_rng_random64_glibc2, 0, 10000, 52848624);
+ rng_test (gsl_rng_random128_glibc2, 0, 10000, 1908609430);
+ rng_test (gsl_rng_random256_glibc2, 0, 10000, 179943260);
+
+ rng_test (gsl_rng_random_bsd, 0, 10000, 1457025928);
+ rng_test (gsl_rng_random8_bsd, 0, 10000, 1910041713);
+ rng_test (gsl_rng_random32_bsd, 0, 10000, 1663114331);
+ rng_test (gsl_rng_random64_bsd, 0, 10000, 864469165);
+ rng_test (gsl_rng_random128_bsd, 0, 10000, 1457025928);
+ rng_test (gsl_rng_random256_bsd, 0, 10000, 1216357476);
+
+ rng_test (gsl_rng_random_libc5, 0, 10000, 428084942);
+ rng_test (gsl_rng_random8_libc5, 0, 10000, 1910041713);
+ rng_test (gsl_rng_random32_libc5, 0, 10000, 1967452027);
+ rng_test (gsl_rng_random64_libc5, 0, 10000, 2106639801);
+ rng_test (gsl_rng_random128_libc5, 0, 10000, 428084942);
+ rng_test (gsl_rng_random256_libc5, 0, 10000, 116367984);
+
+ rng_test (gsl_rng_ranf, 0, 10000, 2152890433UL);
+ rng_test (gsl_rng_ranf, 2, 10000, 339327233);
+
+ /* Test constant relationship between int and double functions */
+
+ for (r = rngs ; *r != 0; r++)
+ rng_float_test (*r);
+
+ /* Test save/restore functions */
+
+ for (r = rngs ; *r != 0; r++)
+ rng_state_test (*r);
+
+ for (r = rngs ; *r != 0; r++)
+ rng_parallel_state_test (*r);
+
+ for (r = rngs ; *r != 0; r++)
+ rng_read_write_test (*r);
+
+ /* generic statistical tests (these are just to make sure that we
+ don't get any crazy results back from the generator, i.e. they
+ aren't a test of the algorithm, just the implementation) */
+
+ for (r = rngs ; *r != 0; r++)
+ generic_rng_test (*r);
+
+ exit (gsl_test_summary ());
+}
+
+
+void
+rng_test (const gsl_rng_type * T, unsigned long int seed, unsigned int n,
+ unsigned long int result)
+{
+ gsl_rng *r = gsl_rng_alloc (T);
+ unsigned int i;
+ unsigned long int k = 0;
+ int status;
+
+ if (seed != 0)
+ {
+ gsl_rng_set (r, seed);
+ }
+
+ for (i = 0; i < n; i++)
+ {
+ k = gsl_rng_get (r);
+ }
+
+ status = (k != result);
+ gsl_test (status, "%s, %u steps (%u observed vs %u expected)",
+ gsl_rng_name (r), n, k, result);
+
+ gsl_rng_free (r);
+}
+
+void
+rng_float_test (const gsl_rng_type * T)
+{
+ gsl_rng *ri = gsl_rng_alloc (T);
+ gsl_rng *rf = gsl_rng_alloc (T);
+
+ double u, c ;
+ unsigned int i;
+ unsigned long int k = 0;
+ int status = 0 ;
+
+ do
+ {
+ k = gsl_rng_get (ri);
+ u = gsl_rng_get (rf);
+ }
+ while (k == 0) ;
+
+ c = k / u ;
+ for (i = 0; i < N2; i++)
+ {
+ k = gsl_rng_get (ri);
+ u = gsl_rng_get (rf);
+ if (c*k != u)
+ {
+ status = 1 ;
+ break ;
+ }
+ }
+
+ gsl_test (status, "%s, ratio of int to double (%g observed vs %g expected)",
+ gsl_rng_name (ri), c, k/u);
+
+ gsl_rng_free (ri);
+ gsl_rng_free (rf);
+}
+
+
+void
+rng_state_test (const gsl_rng_type * T)
+{
+ unsigned long int test_a[N], test_b[N];
+
+ int i;
+
+ gsl_rng *r = gsl_rng_alloc (T);
+ gsl_rng *r_save = gsl_rng_alloc (T);
+
+ for (i = 0; i < N; ++i)
+ {
+ gsl_rng_get (r); /* throw away N iterations */
+ }
+
+ gsl_rng_memcpy (r_save, r); /* save the intermediate state */
+
+ for (i = 0; i < N; ++i)
+ {
+ test_a[i] = gsl_rng_get (r);
+ }
+
+ gsl_rng_memcpy (r, r_save); /* restore the intermediate state */
+ gsl_rng_free (r_save);
+
+ for (i = 0; i < N; ++i)
+ {
+ test_b[i] = gsl_rng_get (r);
+ }
+
+ {
+ int status = 0;
+ for (i = 0; i < N; ++i)
+ {
+ status |= (test_b[i] != test_a[i]);
+ }
+ gsl_test (status, "%s, random number state consistency",
+ gsl_rng_name (r));
+ }
+
+ gsl_rng_free (r);
+}
+
+
+void
+rng_parallel_state_test (const gsl_rng_type * T)
+{
+ unsigned long int test_a[N], test_b[N];
+ unsigned long int test_c[N], test_d[N];
+ double test_e[N], test_f[N];
+
+ int i;
+
+ gsl_rng *r1 = gsl_rng_alloc (T);
+ gsl_rng *r2 = gsl_rng_alloc (T);
+
+ for (i = 0; i < N; ++i)
+ {
+ gsl_rng_get (r1); /* throw away N iterations */
+ }
+
+ gsl_rng_memcpy (r2, r1); /* save the intermediate state */
+
+ for (i = 0; i < N; ++i)
+ {
+ /* check that there is no hidden state intermixed between r1 and r2 */
+ test_a[i] = gsl_rng_get (r1);
+ test_b[i] = gsl_rng_get (r2);
+ test_c[i] = gsl_rng_uniform_int (r1, 1234);
+ test_d[i] = gsl_rng_uniform_int (r2, 1234);
+ test_e[i] = gsl_rng_uniform (r1);
+ test_f[i] = gsl_rng_uniform (r2);
+ }
+
+ {
+ int status = 0;
+ for (i = 0; i < N; ++i)
+ {
+ status |= (test_b[i] != test_a[i]);
+ status |= (test_c[i] != test_d[i]);
+ status |= (test_e[i] != test_f[i]);
+ }
+ gsl_test (status, "%s, parallel random number state consistency",
+ gsl_rng_name (r1));
+ }
+
+ gsl_rng_free (r1);
+ gsl_rng_free (r2);
+
+}
+
+void
+rng_read_write_test (const gsl_rng_type * T)
+{
+ unsigned long int test_a[N], test_b[N];
+
+ int i;
+
+ gsl_rng *r = gsl_rng_alloc (T);
+
+ for (i = 0; i < N; ++i)
+ {
+ gsl_rng_get (r); /* throw away N iterations */
+ }
+
+ { /* save the state to a binary file */
+ FILE *f = fopen("test.dat", "wb");
+ gsl_rng_fwrite(f, r);
+ fclose(f);
+ }
+
+ for (i = 0; i < N; ++i)
+ {
+ test_a[i] = gsl_rng_get (r);
+ }
+
+ { /* read the state from a binary file */
+ FILE *f = fopen("test.dat", "rb");
+ gsl_rng_fread(f, r);
+ fclose(f);
+ }
+
+ for (i = 0; i < N; ++i)
+ {
+ test_b[i] = gsl_rng_get (r);
+ }
+
+ {
+ int status = 0;
+ for (i = 0; i < N; ++i)
+ {
+ status |= (test_b[i] != test_a[i]);
+ }
+ gsl_test (status, "%s, random number generator read and write",
+ gsl_rng_name (r));
+ }
+
+ gsl_rng_free (r);
+}
+
+void
+generic_rng_test (const gsl_rng_type * T)
+{
+ gsl_rng *r = gsl_rng_alloc (T);
+ const char *name = gsl_rng_name (r);
+ unsigned long int kmax = 0, kmin = 1000;
+ double sigma = 0;
+ const unsigned long int ran_max = gsl_rng_max (r);
+ const unsigned long int ran_min = gsl_rng_min (r);
+
+ int status = rng_max_test (r, &kmax, ran_max);
+
+ gsl_test (status,
+ "%s, observed vs theoretical maximum (%lu vs %lu)",
+ name, kmax, ran_max);
+
+ status = rng_min_test (r, &kmin, ran_min, ran_max);
+
+ gsl_test (status,
+ "%s, observed vs theoretical minimum (%lu vs %lu)",
+ name, kmin, ran_min);
+
+ status = rng_sum_test (r, &sigma);
+
+ gsl_test (status,
+ "%s, sum test within acceptable sigma (observed %.2g sigma)",
+ name, sigma);
+
+ status = rng_bin_test (r, &sigma);
+
+ gsl_test (status,
+ "%s, bin test within acceptable chisq (observed %.2g sigma)",
+ name, sigma);
+
+ gsl_rng_set (r, 1); /* set seed to 1 */
+ status = rng_max_test (r, &kmax, ran_max);
+
+ gsl_rng_set (r, 1); /* set seed to 1 */
+ status |= rng_min_test (r, &kmin, ran_min, ran_max);
+
+ gsl_rng_set (r, 1); /* set seed to 1 */
+ status |= rng_sum_test (r, &sigma);
+
+ gsl_test (status, "%s, maximum and sum tests for seed=1", name);
+
+ gsl_rng_set (r, 12345); /* set seed to a "typical" value */
+ status = rng_max_test (r, &kmax, ran_max);
+
+ gsl_rng_set (r, 12345); /* set seed to a "typical" value */
+ status |= rng_min_test (r, &kmin, ran_min, ran_max);
+
+ gsl_rng_set (r, 12345); /* set seed to a "typical" value */
+ status |= rng_sum_test (r, &sigma);
+
+ gsl_test (status, "%s, maximum and sum tests for non-default seeds", name);
+
+ gsl_rng_free (r);
+}
+
+int
+rng_max_test (gsl_rng * r, unsigned long int *kmax, unsigned long int ran_max)
+{
+ unsigned long int actual_uncovered;
+ double expect_uncovered;
+ int status;
+ unsigned long int max = 0;
+ int i;
+
+ for (i = 0; i < N2; ++i)
+ {
+ unsigned long int k = gsl_rng_get (r);
+ if (k > max)
+ max = k;
+ }
+
+ *kmax = max;
+
+ actual_uncovered = ran_max - max;
+ expect_uncovered = (double) ran_max / (double) N2;
+
+ status = (max > ran_max) || (actual_uncovered > 7 * expect_uncovered) ;
+
+ return status;
+}
+
+int
+rng_min_test (gsl_rng * r, unsigned long int *kmin,
+ unsigned long int ran_min, unsigned long int ran_max)
+{
+ unsigned long int actual_uncovered;
+ double expect_uncovered;
+ int status;
+ unsigned long int min = 1000000000UL;
+ int i;
+
+ for (i = 0; i < N2; ++i)
+ {
+ unsigned long int k = gsl_rng_get (r);
+ if (k < min)
+ min = k;
+ }
+
+ *kmin = min;
+
+ actual_uncovered = min - ran_min;
+ expect_uncovered = (double) ran_max / (double) N2;
+
+ status = (min < ran_min) || (actual_uncovered > 7 * expect_uncovered);
+
+ return status;
+}
+
+int
+rng_sum_test (gsl_rng * r, double *sigma)
+{
+ double sum = 0;
+ int i, status;
+
+ for (i = 0; i < N2; ++i)
+ {
+ double x = gsl_rng_uniform (r) - 0.5;
+ sum += x;
+ }
+
+ sum /= N2;
+
+ /* expect the average to have a variance of 1/(12 n) */
+
+ *sigma = sum * sqrt (12.0 * N2);
+
+ /* more than 3 sigma is an error (increased to 3.1 to avoid false alarms) */
+
+ status = (fabs (*sigma) > 3.1 || fabs(*sigma) < 0.003);
+
+ if (status) {
+ fprintf(stderr,"sum=%g, sigma=%g\n",sum,*sigma);
+ }
+
+ return status;
+}
+
+#define BINS 17
+#define EXTRA 10
+int
+rng_bin_test (gsl_rng * r, double *sigma)
+{
+ int count[BINS+EXTRA];
+ double chisq = 0;
+ int i, status;
+
+ for (i = 0; i < BINS+EXTRA; i++)
+ count[i] = 0 ;
+
+
+ for (i = 0; i < N2; i++)
+ {
+ int j = gsl_rng_uniform_int (r, BINS);
+ count[j]++ ;
+ }
+
+ chisq = 0 ;
+ for (i = 0; i < BINS; i++)
+ {
+ double x = (double)N2/(double)BINS ;
+ double d = (count[i] - x) ;
+ chisq += (d*d) / x;
+ }
+
+ *sigma = sqrt(chisq/BINS) ;
+
+ /* more than 3 sigma is an error */
+
+ status = (fabs (*sigma) > 3 || fabs(*sigma) < 0.003);
+
+ for (i = BINS; i < BINS+EXTRA; i++)
+ {
+ if (count[i] != 0)
+ {
+ status = 1 ;
+ gsl_test (status,
+ "%s, wrote outside range in bin test "
+ "(%d observed vs %d expected)",
+ gsl_rng_name(r), i, BINS - 1);
+ }
+ }
+
+ return status;
+}
+
diff --git a/gsl-1.9/rng/transputer.c b/gsl-1.9/rng/transputer.c
new file mode 100644
index 0000000..0bad215
--- /dev/null
+++ b/gsl-1.9/rng/transputer.c
@@ -0,0 +1,83 @@
+/* rng/transputer.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is the INMOS Transputer Development System generator. The sequence is,
+
+ x_{n+1} = (a x_n) mod m
+
+ with a = 1664525 and m = 2^32. The seed specifies the initial
+ value, x_1.
+
+ The theoretical value of x_{10001} is 1244127297.
+
+ The period of this generator is 2^30. */
+
+static inline unsigned long int transputer_get (void *vstate);
+static double transputer_get_double (void *vstate);
+static void transputer_set (void *state, unsigned long int s);
+
+typedef struct
+ {
+ unsigned long int x;
+ }
+transputer_state_t;
+
+static unsigned long int
+transputer_get (void *vstate)
+{
+ transputer_state_t *state = (transputer_state_t *) vstate;
+
+ state->x = (1664525 * state->x) & 0xffffffffUL;
+
+ return state->x;
+}
+
+static double
+transputer_get_double (void *vstate)
+{
+ return transputer_get (vstate) / 4294967296.0 ;
+}
+
+static void
+transputer_set (void *vstate, unsigned long int s)
+{
+ transputer_state_t *state = (transputer_state_t *) vstate;
+
+ if (s == 0)
+ s = 1 ; /* default seed is 1. */
+
+ state->x = s;
+
+ return;
+}
+
+static const gsl_rng_type transputer_type =
+{"transputer", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 1, /* RAND_MIN */
+ sizeof (transputer_state_t),
+ &transputer_set,
+ &transputer_get,
+ &transputer_get_double};
+
+const gsl_rng_type *gsl_rng_transputer = &transputer_type;
diff --git a/gsl-1.9/rng/tt.c b/gsl-1.9/rng/tt.c
new file mode 100644
index 0000000..11f3bde
--- /dev/null
+++ b/gsl-1.9/rng/tt.c
@@ -0,0 +1,143 @@
+/* rng/tt.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is the TT800 twisted GSFR generator for 32 bit integers. It
+ has been superceded by MT19937 (mt.c). The period is 2^800.
+
+ This implementation is based on tt800.c, July 8th 1996 version by
+ M. Matsumoto, email: matumoto@math.keio.ac.jp
+
+ From: Makoto Matsumoto and Yoshiharu Kurita, "Twisted GFSR
+ Generators II", ACM Transactions on Modelling and Computer
+ Simulation, Vol. 4, No. 3, 1994, pages 254-266. */
+
+static inline unsigned long int tt_get (void *vstate);
+static double tt_get_double (void *vstate);
+static void tt_set (void *state, unsigned long int s);
+
+#define N 25
+#define M 7
+
+typedef struct
+ {
+ int n;
+ unsigned long int x[N];
+ }
+tt_state_t;
+
+static inline unsigned long int
+tt_get (void *vstate)
+{
+ tt_state_t *state = (tt_state_t *) vstate;
+
+ /* this is the magic vector, a */
+
+ const unsigned long mag01[2] =
+ {0x00000000, 0x8ebfd028UL};
+ unsigned long int y;
+ unsigned long int *const x = state->x;
+ int n = state->n;
+
+ if (n >= N)
+ {
+ int i;
+ for (i = 0; i < N - M; i++)
+ {
+ x[i] = x[i + M] ^ (x[i] >> 1) ^ mag01[x[i] % 2];
+ }
+ for (; i < N; i++)
+ {
+ x[i] = x[i + (M - N)] ^ (x[i] >> 1) ^ mag01[x[i] % 2];
+ };
+ n = 0;
+ }
+
+ y = x[n];
+ y ^= (y << 7) & 0x2b5b2500UL; /* s and b, magic vectors */
+ y ^= (y << 15) & 0xdb8b0000UL; /* t and c, magic vectors */
+ y &= 0xffffffffUL; /* you may delete this line if word size = 32 */
+
+ /* The following line was added by Makoto Matsumoto in the 1996
+ version to improve lower bit's correlation. Delete this line
+ to use the code published in 1994. */
+
+ y ^= (y >> 16); /* added to the 1994 version */
+
+ state->n = n + 1;
+
+ return y;
+}
+
+static double
+tt_get_double (void * vstate)
+{
+ return tt_get (vstate) / 4294967296.0 ;
+}
+
+static void
+tt_set (void *vstate, unsigned long int s)
+{
+ tt_state_t *state = (tt_state_t *) vstate;
+
+ const tt_state_t init_state =
+ {0,
+ {0x95f24dabUL, 0x0b685215UL, 0xe76ccae7UL,
+ 0xaf3ec239UL, 0x715fad23UL, 0x24a590adUL,
+ 0x69e4b5efUL, 0xbf456141UL, 0x96bc1b7bUL,
+ 0xa7bdf825UL, 0xc1de75b7UL, 0x8858a9c9UL,
+ 0x2da87693UL, 0xb657f9ddUL, 0xffdc8a9fUL,
+ 0x8121da71UL, 0x8b823ecbUL, 0x885d05f5UL,
+ 0x4e20cd47UL, 0x5a9ad5d9UL, 0x512c0c03UL,
+ 0xea857ccdUL, 0x4cc1d30fUL, 0x8891a8a1UL,
+ 0xa6b7aadbUL}};
+
+
+ if (s == 0) /* default seed is given explicitly in the original code */
+ {
+ *state = init_state;
+ }
+ else
+ {
+ int i;
+
+ state->n = 0;
+
+ state->x[0] = s & 0xffffffffUL;
+
+ for (i = 1; i < N; i++)
+ state->x[i] = (69069 * state->x[i - 1]) & 0xffffffffUL;
+ }
+
+ return;
+}
+
+static const gsl_rng_type tt_type =
+{"tt800", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (tt_state_t),
+ &tt_set,
+ &tt_get,
+ &tt_get_double};
+
+const gsl_rng_type *gsl_rng_tt800 = &tt_type;
diff --git a/gsl-1.9/rng/types.c b/gsl-1.9/rng/types.c
new file mode 100644
index 0000000..e8946ec
--- /dev/null
+++ b/gsl-1.9/rng/types.c
@@ -0,0 +1,101 @@
+/* rng/types.c
+ *
+ * Copyright (C) 2001 Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+#define N 100
+
+const gsl_rng_type * gsl_rng_generator_types[N];
+
+#define ADD(t) {if (i==N) abort(); gsl_rng_generator_types[i] = (t); i++; };
+
+const gsl_rng_type **
+gsl_rng_types_setup (void)
+{
+ int i = 0;
+
+ ADD(gsl_rng_borosh13);
+ ADD(gsl_rng_cmrg);
+ ADD(gsl_rng_coveyou);
+ ADD(gsl_rng_fishman18);
+ ADD(gsl_rng_fishman20);
+ ADD(gsl_rng_fishman2x);
+ ADD(gsl_rng_gfsr4);
+ ADD(gsl_rng_knuthran);
+ ADD(gsl_rng_knuthran2);
+ ADD(gsl_rng_knuthran2002);
+ ADD(gsl_rng_lecuyer21);
+ ADD(gsl_rng_minstd);
+ ADD(gsl_rng_mrg);
+ ADD(gsl_rng_mt19937);
+ ADD(gsl_rng_mt19937_1999);
+ ADD(gsl_rng_mt19937_1998);
+ ADD(gsl_rng_r250);
+ ADD(gsl_rng_ran0);
+ ADD(gsl_rng_ran1);
+ ADD(gsl_rng_ran2);
+ ADD(gsl_rng_ran3);
+ ADD(gsl_rng_rand);
+ ADD(gsl_rng_rand48);
+ ADD(gsl_rng_random128_bsd);
+ ADD(gsl_rng_random128_glibc2);
+ ADD(gsl_rng_random128_libc5);
+ ADD(gsl_rng_random256_bsd);
+ ADD(gsl_rng_random256_glibc2);
+ ADD(gsl_rng_random256_libc5);
+ ADD(gsl_rng_random32_bsd);
+ ADD(gsl_rng_random32_glibc2);
+ ADD(gsl_rng_random32_libc5);
+ ADD(gsl_rng_random64_bsd);
+ ADD(gsl_rng_random64_glibc2);
+ ADD(gsl_rng_random64_libc5);
+ ADD(gsl_rng_random8_bsd);
+ ADD(gsl_rng_random8_glibc2);
+ ADD(gsl_rng_random8_libc5);
+ ADD(gsl_rng_random_bsd);
+ ADD(gsl_rng_random_glibc2);
+ ADD(gsl_rng_random_libc5);
+ ADD(gsl_rng_randu);
+ ADD(gsl_rng_ranf);
+ ADD(gsl_rng_ranlux);
+ ADD(gsl_rng_ranlux389);
+ ADD(gsl_rng_ranlxd1);
+ ADD(gsl_rng_ranlxd2);
+ ADD(gsl_rng_ranlxs0);
+ ADD(gsl_rng_ranlxs1);
+ ADD(gsl_rng_ranlxs2);
+ ADD(gsl_rng_ranmar);
+ ADD(gsl_rng_slatec);
+ ADD(gsl_rng_taus);
+ ADD(gsl_rng_taus2);
+ ADD(gsl_rng_taus113);
+ ADD(gsl_rng_transputer);
+ ADD(gsl_rng_tt800);
+ ADD(gsl_rng_uni);
+ ADD(gsl_rng_uni32);
+ ADD(gsl_rng_vax);
+ ADD(gsl_rng_waterman14);
+ ADD(gsl_rng_zuf);
+ ADD(0);
+
+ return gsl_rng_generator_types;
+}
+
diff --git a/gsl-1.9/rng/uni.c b/gsl-1.9/rng/uni.c
new file mode 100644
index 0000000..c43cfa1
--- /dev/null
+++ b/gsl-1.9/rng/uni.c
@@ -0,0 +1,201 @@
+/* rng/uni.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/**
+ This is a lagged Fibonacci generator which supposedly excellent
+ statistical properties (I do not concur)
+
+ I got it from the net and translated into C.
+
+* ======================================================================
+* NIST Guide to Available Math Software.
+* Fullsource for module UNI from package CMLIB.
+* Retrieved from CAMSUN on Tue Oct 8 14:04:10 1996.
+* ======================================================================
+
+C***BEGIN PROLOGUE UNI
+C***DATE WRITTEN 810915
+C***REVISION DATE 830805
+C***CATEGORY NO. L6A21
+C***KEYWORDS RANDOM NUMBERS, UNIFORM RANDOM NUMBERS
+C***AUTHOR BLUE, JAMES, SCIENTIFIC COMPUTING DIVISION, NBS
+C KAHANER, DAVID, SCIENTIFIC COMPUTING DIVISION, NBS
+C MARSAGLIA, GEORGE, COMPUTER SCIENCE DEPT., WASH STATE UNIV
+C
+C***PURPOSE THIS ROUTINE GENERATES QUASI UNIFORM RANDOM NUMBERS ON [0,1
+C AND CAN BE USED ON ANY COMPUTER WITH WHICH ALLOWS INTEGERS
+C AT LEAST AS LARGE AS 32767.
+C***DESCRIPTION
+C
+C THIS ROUTINE GENERATES QUASI UNIFORM RANDOM NUMBERS ON THE INTER
+C [0,1). IT CAN BE USED WITH ANY COMPUTER WHICH ALLOWS
+C INTEGERS AT LEAST AS LARGE AS 32767.
+C
+C
+C USE
+C FIRST TIME....
+C Z = UNI(JD)
+C HERE JD IS ANY N O N - Z E R O INTEGER.
+C THIS CAUSES INITIALIZATION OF THE PROGRAM
+C AND THE FIRST RANDOM NUMBER TO BE RETURNED AS Z.
+C SUBSEQUENT TIMES...
+C Z = UNI(0)
+C CAUSES THE NEXT RANDOM NUMBER TO BE RETURNED AS Z.
+C
+C
+C..................................................................
+C NOTE: USERS WHO WISH TO TRANSPORT THIS PROGRAM FROM ONE COMPUTER
+C TO ANOTHER SHOULD READ THE FOLLOWING INFORMATION.....
+C
+C MACHINE DEPENDENCIES...
+C MDIG = A LOWER BOUND ON THE NUMBER OF BINARY DIGITS AVAILABLE
+C FOR REPRESENTING INTEGERS, INCLUDING THE SIGN BIT.
+C THIS VALUE MUST BE AT LEAST 16, BUT MAY BE INCREASED
+C IN LINE WITH REMARK A BELOW.
+C
+C REMARKS...
+C A. THIS PROGRAM CAN BE USED IN TWO WAYS:
+C (1) TO OBTAIN REPEATABLE RESULTS ON DIFFERENT COMPUTERS,
+C SET 'MDIG' TO THE SMALLEST OF ITS VALUES ON EACH, OR,
+C (2) TO ALLOW THE LONGEST SEQUENCE OF RANDOM NUMBERS TO BE
+C GENERATED WITHOUT CYCLING (REPEATING) SET 'MDIG' TO THE
+C LARGEST POSSIBLE VALUE.
+C B. THE SEQUENCE OF NUMBERS GENERATED DEPENDS ON THE INITIAL
+C INPUT 'JD' AS WELL AS THE VALUE OF 'MDIG'.
+C IF MDIG=16 ONE SHOULD FIND THAT
+ Editors Note: set the seed using 152 in order to get uni(305)
+ -jt
+C THE FIRST EVALUATION
+C Z=UNI(305) GIVES Z=.027832881...
+C THE SECOND EVALUATION
+C Z=UNI(0) GIVES Z=.56102176...
+C THE THIRD EVALUATION
+C Z=UNI(0) GIVES Z=.41456343...
+C THE THOUSANDTH EVALUATION
+C Z=UNI(0) GIVES Z=.19797357...
+C
+C***REFERENCES MARSAGLIA G., "COMMENTS ON THE PERFECT UNIFORM RANDOM
+C NUMBER GENERATOR", UNPUBLISHED NOTES, WASH S. U.
+C***ROUTINES CALLED I1MACH,XERROR
+C***END PROLOGUE UNI
+
+ **/
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+static inline unsigned long int uni_get (void *vstate);
+static double uni_get_double (void *vstate);
+static void uni_set (void *state, unsigned long int s);
+
+static const unsigned int MDIG = 16; /* Machine digits in int */
+static const unsigned int m1 = 32767; /* 2^(MDIG-1) - 1 */
+static const unsigned int m2 = 256; /* 2^(MDIG/2) */
+
+typedef struct
+ {
+ int i, j;
+ unsigned long m[17];
+ }
+uni_state_t;
+
+static inline unsigned long
+uni_get (void *vstate)
+{
+ uni_state_t *state = (uni_state_t *) vstate;
+ const int i = state->i;
+ const int j = state->j;
+
+ /* important k not be unsigned */
+ long k = state->m[i] - state->m[j];
+
+ if (k < 0)
+ k += m1;
+ state->m[j] = k;
+
+ if (i == 0)
+ {
+ state->i = 16;
+ }
+ else
+ {
+ (state->i)--;
+ }
+
+ if (j == 0)
+ {
+ state->j = 16;
+ }
+ else
+ {
+ (state->j)--;
+ }
+
+ return k;
+}
+
+static double
+uni_get_double (void *vstate)
+{
+ return uni_get (vstate) / 32767.0 ;
+}
+
+static void
+uni_set (void *vstate, unsigned long int s)
+{
+ unsigned int i, seed, k0, k1, j0, j1;
+
+ uni_state_t *state = (uni_state_t *) vstate;
+
+ /* For this routine, the seeding is very elaborate! */
+ /* A flaw in this approach is that seeds 1,2 give exactly the
+ same random number sequence! */
+
+ s = 2 * s + 1; /* enforce seed be odd */
+ seed = (s < m1 ? s : m1); /* seed should be less than m1 */
+
+ k0 = 9069 % m2;
+ k1 = 9069 / m2;
+ j0 = seed % m2;
+ j1 = seed / m2;
+
+ for (i = 0; i < 17; ++i)
+ {
+ seed = j0 * k0;
+ j1 = (seed / m2 + j0 * k1 + j1 * k0) % (m2 / 2);
+ j0 = seed % m2;
+ state->m[i] = j0 + m2 * j1;
+ }
+ state->i = 4;
+ state->j = 16;
+
+ return;
+}
+
+static const gsl_rng_type uni_type =
+{"uni", /* name */
+ 32766, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (uni_state_t),
+ &uni_set,
+ &uni_get,
+ &uni_get_double};
+
+const gsl_rng_type *gsl_rng_uni = &uni_type;
diff --git a/gsl-1.9/rng/uni32.c b/gsl-1.9/rng/uni32.c
new file mode 100644
index 0000000..ba5536a
--- /dev/null
+++ b/gsl-1.9/rng/uni32.c
@@ -0,0 +1,203 @@
+/* rng/uni32.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/**
+ This is a lagged Fibonacci generator which supposedly excellent
+ statistical properties (I do not concur)
+
+ I got it from the net and translated into C.
+
+* ======================================================================
+* NIST Guide to Available Math Software.
+* Fullsource for module UNI from package CMLIB.
+* Retrieved from CAMSUN on Tue Oct 8 14:04:10 1996.
+* ======================================================================
+
+C***BEGIN PROLOGUE UNI
+C***DATE WRITTEN 810915
+C***REVISION DATE 830805
+C***CATEGORY NO. L6A21
+C***KEYWORDS RANDOM NUMBERS, UNIFORM RANDOM NUMBERS
+C***AUTHOR BLUE, JAMES, SCIENTIFIC COMPUTING DIVISION, NBS
+C KAHANER, DAVID, SCIENTIFIC COMPUTING DIVISION, NBS
+C MARSAGLIA, GEORGE, COMPUTER SCIENCE DEPT., WASH STATE UNIV
+C
+C***PURPOSE THIS ROUTINE GENERATES QUASI UNIFORM RANDOM NUMBERS ON [0,1
+C AND CAN BE USED ON ANY COMPUTER WITH WHICH ALLOWS INTEGERS
+C AT LEAST AS LARGE AS 32767.
+C***DESCRIPTION
+C
+C THIS ROUTINE GENERATES QUASI UNIFORM RANDOM NUMBERS ON THE INTER
+C [0,1). IT CAN BE USED WITH ANY COMPUTER WHICH ALLOWS
+C INTEGERS AT LEAST AS LARGE AS 32767.
+C
+C
+C USE
+C FIRST TIME....
+C Z = UNI(JD)
+C HERE JD IS ANY N O N - Z E R O INTEGER.
+C THIS CAUSES INITIALIZATION OF THE PROGRAM
+C AND THE FIRST RANDOM NUMBER TO BE RETURNED AS Z.
+C SUBSEQUENT TIMES...
+C Z = UNI(0)
+C CAUSES THE NEXT RANDOM NUMBER TO BE RETURNED AS Z.
+C
+C
+C..................................................................
+C NOTE: USERS WHO WISH TO TRANSPORT THIS PROGRAM FROM ONE COMPUTER
+C TO ANOTHER SHOULD READ THE FOLLOWING INFORMATION.....
+C
+C MACHINE DEPENDENCIES...
+C MDIG = A LOWER BOUND ON THE NUMBER OF BINARY DIGITS AVAILABLE
+C FOR REPRESENTING INTEGERS, INCLUDING THE SIGN BIT.
+C THIS VALUE MUST BE AT LEAST 16, BUT MAY BE INCREASED
+C IN LINE WITH REMARK A BELOW.
+C
+C REMARKS...
+C A. THIS PROGRAM CAN BE USED IN TWO WAYS:
+C (1) TO OBTAIN REPEATABLE RESULTS ON DIFFERENT COMPUTERS,
+C SET 'MDIG' TO THE SMALLEST OF ITS VALUES ON EACH, OR,
+C (2) TO ALLOW THE LONGEST SEQUENCE OF RANDOM NUMBERS TO BE
+C GENERATED WITHOUT CYCLING (REPEATING) SET 'MDIG' TO THE
+C LARGEST POSSIBLE VALUE.
+C B. THE SEQUENCE OF NUMBERS GENERATED DEPENDS ON THE INITIAL
+C INPUT 'JD' AS WELL AS THE VALUE OF 'MDIG'.
+C IF MDIG=16 ONE SHOULD FIND THAT
+ Editors Note: set the seed using 152 in order to get uni(305)
+ -jt
+C THE FIRST EVALUATION
+C Z=UNI(305) GIVES Z=.027832881...
+C THE SECOND EVALUATION
+C Z=UNI(0) GIVES Z=.56102176...
+C THE THIRD EVALUATION
+C Z=UNI(0) GIVES Z=.41456343...
+C THE THOUSANDTH EVALUATION
+C Z=UNI(0) GIVES Z=.19797357...
+C
+C***REFERENCES MARSAGLIA G., "COMMENTS ON THE PERFECT UNIFORM RANDOM
+C NUMBER GENERATOR", UNPUBLISHED NOTES, WASH S. U.
+C***ROUTINES CALLED I1MACH,XERROR
+C***END PROLOGUE UNI
+
+ **/
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+static inline unsigned long int uni32_get (void *vstate);
+static double uni32_get_double (void *vstate);
+static void uni32_set (void *state, unsigned long int s);
+
+static const unsigned long int MDIG = 32; /* Machine digits in int */
+static const unsigned long int m1 = 2147483647; /* 2^(MDIG-1) - 1 */
+static const unsigned long int m2 = 65536; /* 2^(MDIG/2) */
+
+typedef struct
+ {
+ int i, j;
+ unsigned long m[17];
+ }
+uni32_state_t;
+
+static inline unsigned long
+uni32_get (void *vstate)
+{
+ uni32_state_t *state = (uni32_state_t *) vstate;
+ const long int i = state->i;
+ const long int j = state->j;
+
+ /* important k not be unsigned */
+ long int k = state->m[i] - state->m[j];
+
+ if (k < 0)
+ k += m1;
+ state->m[j] = k;
+
+ if (i == 0)
+ {
+ state->i = 16;
+ }
+ else
+ {
+ (state->i)--;
+ }
+
+ if (j == 0)
+ {
+ state->j = 16;
+ }
+ else
+ {
+ (state->j)--;
+ }
+
+ return k;
+}
+
+static double
+uni32_get_double (void *vstate)
+{
+ return uni32_get (vstate) / 2147483647.0 ;
+}
+
+static void
+uni32_set (void *vstate, unsigned long int s)
+{
+ long int seed, k0, k1, j0, j1;
+ int i;
+
+ uni32_state_t *state = (uni32_state_t *) vstate;
+
+ /* For this routine, the seeding is very elaborate! */
+ /* A flaw in this approach is that seeds 1,2 give exactly the
+ same random number sequence! */
+
+ /*s = 2*s+1; *//* enforce seed be odd */
+ seed = (s < m1 ? s : m1); /* seed should be less than m1 */
+ seed -= (seed % 2 == 0 ? 1 : 0);
+
+ k0 = 9069 % m2;
+ k1 = 9069 / m2;
+ j0 = seed % m2;
+ j1 = seed / m2;
+
+ for (i = 0; i < 17; i++)
+ {
+ seed = j0 * k0;
+ j1 = (seed / m2 + j0 * k1 + j1 * k0) % (m2 / 2);
+ j0 = seed % m2;
+ state->m[i] = j0 + m2 * j1;
+ }
+ state->i = 4;
+ state->j = 16;
+
+ return;
+}
+
+static const gsl_rng_type uni32_type =
+{"uni32", /* name */
+ 2147483646, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (uni32_state_t),
+ &uni32_set,
+ &uni32_get,
+ &uni32_get_double};
+
+const gsl_rng_type *gsl_rng_uni32 = &uni32_type;
diff --git a/gsl-1.9/rng/vax.c b/gsl-1.9/rng/vax.c
new file mode 100644
index 0000000..8c0f725
--- /dev/null
+++ b/gsl-1.9/rng/vax.c
@@ -0,0 +1,83 @@
+/* rng/vax.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* This is the old vax generator MTH$RANDOM. The sequence is,
+
+ x_{n+1} = (a x_n + c) mod m
+
+ with a = 69069, c = 1 and m = 2^32. The seed specifies the initial
+ value, x_1.
+
+ The theoretical value of x_{10001} is 3051034865.
+
+ The period of this generator is 2^32. */
+
+static inline unsigned long int vax_get (void *vstate);
+static double vax_get_double (void *vstate);
+static void vax_set (void *state, unsigned long int s);
+
+typedef struct
+ {
+ unsigned long int x;
+ }
+vax_state_t;
+
+static inline unsigned long int
+vax_get (void *vstate)
+{
+ vax_state_t *state = (vax_state_t *) vstate;
+
+ state->x = (69069 * state->x + 1) & 0xffffffffUL;
+
+ return state->x;
+}
+
+static double
+vax_get_double (void *vstate)
+{
+ return vax_get (vstate) / 4294967296.0 ;
+}
+
+static void
+vax_set (void *vstate, unsigned long int s)
+{
+ vax_state_t *state = (vax_state_t *) vstate;
+
+ /* default seed is 0. The constant term c stops the series from
+ collapsing to 0,0,0,0,0,... */
+
+ state->x = s;
+
+ return;
+}
+
+static const gsl_rng_type vax_type =
+{"vax", /* name */
+ 0xffffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (vax_state_t),
+ &vax_set,
+ &vax_get,
+ &vax_get_double};
+
+const gsl_rng_type *gsl_rng_vax = &vax_type;
diff --git a/gsl-1.9/rng/waterman14.c b/gsl-1.9/rng/waterman14.c
new file mode 100644
index 0000000..070129b
--- /dev/null
+++ b/gsl-1.9/rng/waterman14.c
@@ -0,0 +1,92 @@
+/* rng/waterman14.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * This generator is taken from
+ *
+ * Donald E. Knuth
+ * The Art of Computer Programming
+ * Volume 2
+ * Third Edition
+ * Addison-Wesley
+ * Page 106-108
+ *
+ * It is called "Waterman".
+ *
+ * This implementation copyright (C) 2001 Carlo Perassi
+ * and (C) 2003 Heiko Bauke.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+#define AA 1566083941UL
+#define MM 0xffffffffUL /* 2 ^ 32 - 1 */
+
+static inline unsigned long int ran_get (void *vstate);
+static double ran_get_double (void *vstate);
+static void ran_set (void *state, unsigned long int s);
+
+typedef struct
+{
+ unsigned long int x;
+}
+ran_state_t;
+
+static inline unsigned long int
+ran_get (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ state->x = (AA * state->x) & MM;
+
+ return state->x;
+}
+
+static double
+ran_get_double (void *vstate)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ return ran_get (state) / 4294967296.0;
+}
+
+static void
+ran_set (void *vstate, unsigned long int s)
+{
+ ran_state_t *state = (ran_state_t *) vstate;
+
+ if (s == 0)
+ s = 1; /* default seed is 1 */
+
+ state->x = s & MM;
+
+ return;
+}
+
+static const gsl_rng_type ran_type = {
+ "waterman14", /* name */
+ MM, /* RAND_MAX */
+ 1, /* RAND_MIN */
+ sizeof (ran_state_t),
+ &ran_set,
+ &ran_get,
+ &ran_get_double
+};
+
+const gsl_rng_type *gsl_rng_waterman14 = &ran_type;
diff --git a/gsl-1.9/rng/zuf.c b/gsl-1.9/rng/zuf.c
new file mode 100644
index 0000000..6996b5e
--- /dev/null
+++ b/gsl-1.9/rng/zuf.c
@@ -0,0 +1,141 @@
+/* rng/zuf.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <gsl/gsl_rng.h>
+
+/* It is crucial that m == n-273 mod 607 at all times;
+ For speed of execution, however, this is never enforced.
+ Instead is is set in the initializer: note 607-273=334
+ Note also that the state.u[607] is not initialized */
+
+static inline unsigned long int zuf_get (void *vstate);
+static double zuf_get_double (void *vstate);
+static void zuf_set (void *state, unsigned long int s);
+
+static const unsigned long int zuf_randmax = 16777216; /* 2^24 */
+
+typedef struct
+ {
+ int n;
+ unsigned long int u[607];
+ }
+zuf_state_t;
+
+/* The zufall package was implemented with float's, which is to say 24
+ bits of precision. Since I'm using long's instead, my RANDMAX
+ reflects this. */
+
+static inline unsigned long int
+zuf_get (void *vstate)
+{
+ zuf_state_t *state = (zuf_state_t *) vstate;
+ const int n = state->n;
+ const int m = (n - 273 + 607) % 607;
+ unsigned long int t = state->u[n] + state->u[m];
+
+ while (t > zuf_randmax)
+ t -= zuf_randmax;
+
+ state->u[n] = t;
+
+ if (n == 606)
+ {
+ state->n = 0;
+ }
+ else
+ {
+ state->n = n + 1;
+ }
+
+ return t;
+}
+
+static double
+zuf_get_double (void *vstate)
+{
+ return zuf_get (vstate) / 16777216.0 ;
+}
+
+static void
+zuf_set (void *vstate, unsigned long int s)
+{
+ /* A very elaborate seeding procedure is provided with the
+ zufall package; this is virtually a copy of that procedure */
+
+ /* Initialized data */
+
+ long int kl = 9373;
+ long int ij = 1802;
+
+ /* Local variables */
+ long int i, j, k, l, m;
+ double x, y;
+ long int ii, jj;
+
+ zuf_state_t *state = (zuf_state_t *) vstate;
+
+ state->n = 0;
+
+/* generates initial seed buffer by linear congruential */
+/* method. Taken from Marsaglia, FSU report FSU-SCRI-87-50 */
+/* variable seed should be 0 < seed <31328 */
+
+ if (s == 0)
+ s = 1802; /* default seed is 1802 */
+
+ ij = s;
+
+ i = ij / 177 % 177 + 2;
+ j = ij % 177 + 2;
+ k = kl / 169 % 178 + 1;
+ l = kl % 169;
+ for (ii = 0; ii < 607; ++ii)
+ {
+ x = 0.0;
+ y = 0.5;
+ /* 24 bits?? */
+ for (jj = 1; jj <= 24; ++jj)
+ {
+ m = i * j % 179 * k % 179;
+ i = j;
+ j = k;
+ k = m;
+ l = (l * 53 + 1) % 169;
+ if (l * m % 64 >= 32)
+ {
+ x += y;
+ }
+ y *= 0.5;
+ }
+ state->u[ii] = (unsigned long int) (x * zuf_randmax);
+ }
+}
+
+static const gsl_rng_type zuf_type =
+{"zuf", /* name */
+ 0x00ffffffUL, /* RAND_MAX */
+ 0, /* RAND_MIN */
+ sizeof (zuf_state_t),
+ &zuf_set,
+ &zuf_get,
+ &zuf_get_double};
+
+const gsl_rng_type *gsl_rng_zuf = &zuf_type;