Elsevier Science Home
Computer Physics Communications Program Library
Full text online from Science Direct
Programs in Physics & Physical Chemistry
CPC Home

[Licence| Download | New Version Template] aaxt_v1_0.gz(8 Kbytes)
Manuscript Title: Algorithms for random sampling from single-variate distributions.
Authors: F. Salvat
Program title: SUBROUTINE PACKAGE SAMPLE
Catalogue identifier: AAXT_v1_0
Distribution format: gz
Journal reference: Comput. Phys. Commun. 46(1987)427
Programming language: Fortran.
Computer: IBM 3083 XE.
Operating system: VM/SP CMS.
RAM: 117K words
Word size: 8
Keywords: General purpose, Statistical methods, Random sampling, Generation of random deviates, Monte Carlo method, Acceptance-rejection method, Simulation.
Classification: 4.13.

Nature of problem:
This subroutine package allows generation of random deviates from discrete, step-wise and continuous single-variate distributions.

Solution method:
Random sampling from discrete distributions is performed using a modification of Walker's procedure which also provides the basis for a fast generation from step-wise distributions. Step-wise functions are adopted to set up a series of acceptance-rejection procedures, as well as approximate sampling methods, for continuous distributions.

Restrictions:
The distributions must have finite domain, otherwise the domain has to be truncated for computational purposes.

Running time:
Generation of a random value takes 17 msec for a discrete distribution and 22 msec for a step-wise distribution. These times are practically independent of the distribution. The time consumed to sample a random deviate from a continuous distribution depends to a great extent on the characteristics of the distribution (about 55 msec for an expotential distribution).