zufall.c.README
1README for zufall random number package, C version
2------ --- ------ ------ ------ ------- - -------
3
4[NOTE: I have not done extension testing of this port.
5 use at your own risk. The output of the original
6 FORTRAN program is in zufall.orig.output. The
7 original FORTRAN source is at
8 netlib.att.com:netlib/random/zufall.f.Z --jdm]
9
10This package contains a portable random number generator set
11for: uniform (u in [0,1)), normal (<g> = 0, <g^2> = 1), and
12Poisson distributions. The basic module, the uniform generator,
13uses a lagged Fibonacci series generator:
14
15 t = u[n-273] + u[n-607]
16 u[n] = t - (float) ((int) t)
17
18where each number generated, u[k], is floating point. Since
19the numbers are floating point, the left end boundary of the
20range contains zero. This package was ported from FORTRAN
21to K&R C.
22
23To compile this beast, edit the Makefile and run 'make'
24
25External documentation, "Lagged Fibonacci Random Number Generators
26for the NEC SX-3," is to be published in the International
27Journal of High Speed Computing (1993). Otherwise, ask the
28original author:
29
30 W. P. Petersen
31 IPS, RZ F-5
32 ETHZ
33 CH 8092, Zurich
34 Switzerland
35
36e-mail: wpp@ips.ethz.ch.
37
38The port to C was done by Darrell McCauley <darrell@mccauley-usa.com>
39
40The package contains the following routines:
41------------------------------------------------------
42UNIFORM generator routines:
43
44 int zufalli(seed) /* initializes common block containing seeds. */
45 int seed; /* if seed=0, the default value is 1802. */
46
47 int zufall(n,u) /* returns set of n uniforms u[0], ..., u[n-1]. */
48 int n
49 double *u;
50
51 int zufallsv(zusave) /* saves buffer and pointer in zusave, */
52 double *zusave; /* for later restarts. zusave must have */
53 /* at least 608 doubles allocated */
54
55 int zufallrs(zusave) /* restores seed buffer and pointer */
56 double *zusave; /* from zusave. zusave must have */
57 /* at least 608 doubles allocated */
58
59------------------------------------------------------
60NORMAL generator routines:
61
62 int normalen(n,g) /* returns set of n normals g(1), ..., g(n) */
63 int n; /* such that mean <g> = 0, and variance <g**2> = 1. */
64 double *g;
65
66 int normalsv(normsv) /* saves zufall seed buffer and pointer in normsv */
67 double *normsv; /* buffer/pointer for normalen restart also in normsv */
68 /* normsv must at least 1634 doubles allocated */
69
70 int normalrs(normsv) /* restores zufall seed buffer/pointer and */
71 double *normsv; /* buffer/pointer for normalen restart from normsv */
72 /* normsv must at least 1634 doubles allocated */
73------------------------------------------------------
74POISSON generator routine:
75
76 int fische(n,mu,q) /* assigns set of n integers q, with Poisson */
77 int n, *q; /* distribution, density p(q,mu) = exp(-mu) mu**q/q! */
78 double mu; /* Use zufallsv and zufallrs for stop/restart
79 /* sequence */
80
zufall.f77.README
1* README for zufall random number package
2* ------ --- ------ ------ ------ -------
3* This package contains a portable random number generator set
4* for: uniform (u in [0,1)), normal (<g> = 0, <g^2> = 1), and
5* Poisson distributions. The basic module, the uniform generator,
6* uses a lagged Fibonacci series generator:
7*
8* t = u(n-273) + u(n-607)
9* u(n) = t - float(int(t))
10*
11* where each number generated, u(k), is floating point. Since
12* the numbers are floating point, the left end boundary of the
13* range contains zero. This package is nearly portable except
14* for the following. (1) It is written in lower case, (2) the
15* test package contains a timer (second) which is not portable,
16* and (3) there are cycle times (in seconds) in data statements
17* for NEC SX-3, Fujitsu VP2200, and Cray Y-MP. Select your
18* favorite and comment out the others. Replacement functions
19* for 'second' are included - comment out the others. Otherwise
20* the package is portable and returns the same set of floating
21* point numbers up to word precision on any machine. There are
22* compiler directives ($cdir for Cray, *vdir for SX-3, and VOCL
23* for Fujitsu VP2200) which should be otherwise ignored.
24*
25* To compile this beast, note that all floating point numbers
26* are declared 'double precision'. On Cray X-MP, Y-MP, and C-90
27* machines, use the cft77 (cf77) option -dp to run this in 64
28* bit mode (not 128 bit double).
29*
30* External documentation, "Lagged Fibonacci Random Number Generators
31* for the NEC SX-3," is to be published in the International
32* Journal of High Speed Computing (1993). Otherwise, ask the
33* author:
34*
35* W. P. Petersen
36* IPS, RZ F-5
37* ETHZ
38* CH 8092, Zurich
39* Switzerland
40*
41* e-mail: wpp@ips.ethz.ch.
42*
43* The package contains the following routines:
44*
45* ------------------------------------------------------
46* UNIFORM generator routines:
47*
48* subroutine zufalli(seed)
49* integer seed
50* c initializes common block containing seeds. if seed=0,
51* c the default value is 1802.
52*
53* subroutine zufall(n,u)
54* integer n
55* double precision u(n)
56* c returns set of n uniforms u(1), ..., u(n).
57*
58* subroutine zufallsv(zusave)
59* double precision zusave(608)
60* c saves buffer and pointer in zusave, for later restarts
61*
62* subroutine zufallrs(zusave)
63* double precision zusave(608)
64* c restores seed buffer and pointer from zusave
65* ------------------------------------------------------
66*
67* NORMAL generator routines:
68*
69* subroutine normalen(n,g)
70* integer n
71* double precision g(n)
72* c returns set of n normals g(1), ..., g(n) such that
73* c mean <g> = 0, and variance <g**2> = 1.
74*
75* subroutine normalsv(normsv)
76* double precision normsv(1634)
77* c saves zufall seed buffer and pointer in normsv
78* c buffer/pointer for normalen restart also in normsv
79*
80* subroutine normalrs(normsv)
81* double precision normsv(1634)
82* c restores zufall seed buffer/pointer and
83* c buffer/pointer for normalen restart from normsv
84* ------------------------------------------------------
85*
86* POISSON generator routine:
87*
88* subroutine fische(n,mu,q)
89* integer n,q(n)
90* double precision mu
91* c returns set of n integers q, with poisson
92* c distribution, density p(q,mu) = exp(-mu) mu**q/q!
93* c
94* c USE zufallsv and zufallrs for stop/restart sequence
95* c
96