Springer Nature is making SARS-CoV-2 and COVID-19 research free. View research | View latest news | Sign up for updates

Computer methods for sampling from gamma, beta, poisson and bionomial distributions

Computermethoden zur Erzeugung Gamma-, Beta-, Poisson- und Binomialverteilter Zufallszahlen


Accurate computer methods are evaluated which transform uniformly distributed random numbers into quantities that follow gamma, beta, Poisson, binomial and negative-binomial distributions. All algorithms are designed for variable parameters. The known convenient methods are slow when the parameters are large. Therefore new procedures are introduced which can cope efficiently with parameters of all sizes. Some algorithms require sampling from the normal distribution as an intermediate step. In the reported computer experiments the normal deviates were obtained from a recent method which is also described.


Zur Erzeugung nicht-gleichverteilter Zufallszahlen braucht man Methoden, die gleichverteilte Zufallszahlen in Größen der gegebenen Verteilung transformieren. Es werden Transformationen untersucht, die Gamma-, Beta-, Poisson- oder Binomial-verteilte Zufallszahlen produzieren. Approximative Verfahren werden nicht behandelt. Die bisher bekannten Algorithmen sind langsam, wenn die Parameter der Verteilungen groß sind. Daher werden neue Methoden eingeführt, die diesen Nachteil weitgehend vermeiden. In allen Verfahren dürfen die Parameter beliebig und jedesmal neu gewählt werden. Für manche Transformationen werden normalverteilte Zufallszahlen als Zwischenschritt benötigt; die hierfür verwendete Methode ist ebenfalls angegeben.

This is a preview of subscription content, log in to check access.


  1. [1]

    Ahrens, J. H., and U. Dieter: Computer methods for sampling from the exponential and normal distributions. Comm. ACM15, 873–882 (1972).

  2. [2]

    Ahrens, J. H., and U. Dieter: Extensions of Forsythe's method for random sampling from the normal distribution. Math. Comput.27, 927–937 (1973).

  3. [3]

    Ahrens, J. H., U. Dieter, and A. Grube: Pseudo-random numbers: A new proposal for the choice of multiplicators. Computing6, 121–138 (1970).

  4. [4]

    Bankövi, G.: A note on the generation of beta-distributed and gamma-distributed random variables. Publ. Math. Inst. Hung. Acad. Scie.9, 555–563 (1964).

  5. [5]

    Békéssy, A.: Remarks on beta-distributed random numbers. Publ. Math. Inst. Hung. Acad. Scie.9, 565–571 (1964).

  6. [6]

    Dieter, U.: Autokorrelation multiplikativ-erzeugter Pseudo-Zufallszahlen. Operations Res. Verfahren6, 69–85 (1969).

  7. [7]

    Dieter, U.: Pseudo-random numbers: The exact distribution of pairs. Math. Comput.25, 855–883 (1971).

  8. [8]

    Dieter, U.: Pseudo-random numbers: Permutations of triplets. J. Res. Nat. Bureau Standards (to appear).

  9. [9]

    Dieter, U., and J. H. Ahrens: An exact determination of serial correlations of pseudo-random numbers. Numer. Math.17, 101–123 (1971).

  10. [10]

    Dieter, U., and J. H. Ahrens: A combinational method for the generation of normally distributed random numbers. Computing11, 137–146 (1973).

  11. [11]

    Dieter, U., and J. H. Ahrens: Pseudo-random numbers. Preliminary version in preprint, 1972. (340 pages).

  12. [12]

    Fisz, M.: Probability Theory and Mathematical Statistics. New York: J. Wiley. 1962.

  13. [13]

    Forsythe, G. E.: Von Neumann's comparison method for random sampling from the normal and other distributions. Math. Comput.26, 817–826 (1972).

  14. [14]

    Jöhnk, M. D.: Erzeugen von betaverteilten und gammaverteilten Zufallszahlen. Metrika8, 5–15 (1964).

  15. [15]

    Jöhnk, M. D.: Erzeugen und Tasten von Zufallszahlen. (Berichte aus dem Institut für Statistik und aus dem Institut für Angewandte Statistik der FU Berlin, Heft 6.) Würzburg: Physica-Verlag. 1969.

  16. [16]

    Knuth, D. E.: The art of computer programming, Vol. II: Seminumerical algorithms. Reading, Mass.: Addison Wesley. 1969.

  17. [17]

    Léger, R.: On sampling from the negative binomial and Weibull distributions. Master's thesis, Dalhousie University, Halifax, N.S., 1973.

  18. [18]

    MacLaren, M. D., G. Marsaglia, and T. A. Bray: A fast procedure for generating normal random variables. Comm. ACM7, 4–10 (1964).

  19. [19]

    Marsaglia, G.: Expressing a random variable in terms of uniform random variables. Ann. Math. Stat.32, 894–899 (1961).

  20. [20]

    Marsaglia, G.: Random variables and computers. Trans. Third Prague Conf. Information Theory, Statistics and Decision Functions. Prague 1964, 499–512.

  21. [21]

    Payne, W. H., and T. G. Lewis: Conditional bit sampling: Accuracy and speed. Math. Software (Rice, J. R., ed.). Academic Press. 1971.

  22. [22]

    Relles, D. A.: A simple algorithm for generating binomial random variables whenN is large. J. Am. Stat. Ass.67, 612–613 (1972).

  23. [23]

    von Neumann, J.: Various techniques in connection with random digits. Monte Carlo Methods. Nat. Bureau Standards, AMS12, 36–38 (1951).

Download references

Author information

Additional information

This research was supported by the National Research Council of Canada and by Deutsche Forschungsgemeinschaft.

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Ahrens, J.H., Dieter, U. Computer methods for sampling from gamma, beta, poisson and bionomial distributions. Computing 12, 223–246 (1974).

Download citation

Key words and phrases

  • Random numbers
  • pseudorandom
  • normal distribution
  • gamma distribution
  • bei distribution
  • Poisson distribution
  • binomial distribution
  • simulation
  • numerical analysis