# Distribution Generators

VSL routines are used to generate random numbers with different types of distribution. Each function group is introduced below by the type of underlying distribution and contains a short description of its functionality, as well as specifications of the call sequence for both FORTRAN and C-interface and the explanation of input and output parameters. Table “Continuous Distribution Generators” and Table “Discrete Distribution Generators” list the random number generator routines, together with used data types, output distributions, and sets correspondence between data types of the generator routines and called basic random number generators.

Continuous Distribution Generators
Type of Distribution | Data Types | BRNG Data Type | Description
--- | --- | --- | ---
Uniform | s, d | s, d | Uniform continuous distribution on the interval [a,b].
Gaussian | s, d | s, d | Normal (Gaussian) distribution.
GaussianMV | s, d | s, d | Multivariate normal (Gaussian) distribution.
Exponential | s, d | s, d | Exponential distribution.
Laplace | s, d | s, d | Laplace distribution (double exponential distribution).
Weibull | s, d | s, d | Weibull distribution.
Cauchy | s, d | s, d | Cauchy distribution.
Rayleigh | s, d | s, d | Rayleigh distribution.
Lognormal | s, d | s, d | Lognormal distribution.
Gumbel | s, d | s, d | Gumbel (extreme value) distribution.
Gamma | s, d | s, d | Gamma distribution.
Beta | s, d | s, d | Beta distribution.

Discrete Distribution Generators
Type of Distribution | Data Types | BRNG Data Type | Description
--- | --- | --- | ---
Uniform | i | d | Uniform discrete distribution on the interval [a,b).
UniformBits | i | i | Generator of integer random values with uniform bit distribution.
Bernoulli | i | s | Bernoulli distribution.
Geometric | i | s | Geometric distribution.
Binomial | i | d | Binomial distribution.
Hypergeometric | i | d | Hypergeometric distribution.
Poisson | i | s (for VSL_METHOD_IPOISSON_POISNORM) s (for distribution parameter λ≥ 27) and d (for λ < 27) (for VSL_METHOD_IPOISSON_PTPE) | Poisson distribution.
PoissonV | i | s | Poisson distribution with varying mean.
NegBinomial | i | d | Negative binomial distribution, or Pascal distribution.

The library provides two modes of random number generation, accurate and fast. Accurate generation mode is intended for the applications that are highly demanding to accuracy of calculations. When used in this mode, the generators produce random numbers lying completely within definitional domain for all values of the distribution parameters. For example, random numbers obtained from the generator of continuous distribution that is uniform on interval [a,b] belong to this interval irrespective of what a and b values may be. Fast mode provides high performance of generation and also guaranties that generated random numbers belong to the definitional domain except for some specific values of distribution parameters. The generation mode is set by specifying relevant value of the method parameter in generator routines. List of distributions that support accurate mode of generation is given in the table below.

Distribution Generators Supporting Accurate Mode
Type of Distribution | Data Types
--- | ---
Uniform | s, d
Exponential | s, d
Weibull | s, d
Rayleigh | s, d
Lognormal | s, d
Gamma | s, d
Beta | s, d

See additional details about accurate and fast mode of random number generation in VSL Notes.