zufall.c.README 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. README for zufall random number package, C version
  2. ------ --- ------ ------ ------ ------- - -------
  3. [NOTE: I have not done extension testing of this port.
  4. use at your own risk. The output of the original
  5. FORTRAN program is in zufall.orig.output. The
  6. original FORTRAN source is at
  7. netlib.att.com:netlib/random/zufall.f.Z --jdm]
  8. This package contains a portable random number generator set
  9. for: uniform (u in [0,1)), normal (<g> = 0, <g^2> = 1), and
  10. Poisson distributions. The basic module, the uniform generator,
  11. uses a lagged Fibonacci series generator:
  12. t = u[n-273] + u[n-607]
  13. u[n] = t - (float) ((int) t)
  14. where each number generated, u[k], is floating point. Since
  15. the numbers are floating point, the left end boundary of the
  16. range contains zero. This package was ported from FORTRAN
  17. to K&R C.
  18. To compile this beast, edit the Makefile and run 'make'
  19. External documentation, "Lagged Fibonacci Random Number Generators
  20. for the NEC SX-3," is to be published in the International
  21. Journal of High Speed Computing (1993). Otherwise, ask the
  22. original author:
  23. W. P. Petersen
  24. IPS, RZ F-5
  25. ETHZ
  26. CH 8092, Zurich
  27. Switzerland
  28. e-mail: wpp@ips.ethz.ch.
  29. The port to C was done by Darrell McCauley <darrell@mccauley-usa.com>
  30. The package contains the following routines:
  31. ------------------------------------------------------
  32. UNIFORM generator routines:
  33. int zufalli(seed) /* initializes common block containing seeds. */
  34. int seed; /* if seed=0, the default value is 1802. */
  35. int zufall(n,u) /* returns set of n uniforms u[0], ..., u[n-1]. */
  36. int n
  37. double *u;
  38. int zufallsv(zusave) /* saves buffer and pointer in zusave, */
  39. double *zusave; /* for later restarts. zusave must have */
  40. /* at least 608 doubles allocated */
  41. int zufallrs(zusave) /* restores seed buffer and pointer */
  42. double *zusave; /* from zusave. zusave must have */
  43. /* at least 608 doubles allocated */
  44. ------------------------------------------------------
  45. NORMAL generator routines:
  46. int normalen(n,g) /* returns set of n normals g(1), ..., g(n) */
  47. int n; /* such that mean <g> = 0, and variance <g**2> = 1. */
  48. double *g;
  49. int normalsv(normsv) /* saves zufall seed buffer and pointer in normsv */
  50. double *normsv; /* buffer/pointer for normalen restart also in normsv */
  51. /* normsv must at least 1634 doubles allocated */
  52. int normalrs(normsv) /* restores zufall seed buffer/pointer and */
  53. double *normsv; /* buffer/pointer for normalen restart from normsv */
  54. /* normsv must at least 1634 doubles allocated */
  55. ------------------------------------------------------
  56. POISSON generator routine:
  57. int fische(n,mu,q) /* assigns set of n integers q, with Poisson */
  58. int n, *q; /* distribution, density p(q,mu) = exp(-mu) mu**q/q! */
  59. double mu; /* Use zufallsv and zufallrs for stop/restart
  60. /* sequence */