Developer Reference for Intel® oneAPI Math Kernel Library for C
Distribution Generators
oneMKL VS 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 and the explanation of input and output parameters. Table “Continuous Distribution Generators” and Table “Discrete Distribution Generators” list the random number generator routines with data types and output distributions, and sets correspondence between data types of the generator routines and the basic random number generators.
Continuous Distribution Generators Type of Distribution |
Data Types |
BRNG Data Type |
Description |
|---|---|---|---|
vRngUniform (Generates random numbers with uniform distribution.) |
s , d |
s , d |
Uniform continuous distribution on the interval [ a,b ) |
vRngGaussian (Generates normally distributed random numbers.) |
s , d |
s , d |
Normal (Gaussian) distribution |
vRngGaussianMV (Generates random numbers from multivariate normal distribution.) |
s , d |
s , d |
Normal (Gaussian) multivariate distribution |
vRngExponential (Generates exponentially distributed random numbers.) |
s , d |
s , d |
Exponential distribution |
vRngLaplace (Generates random numbers with Laplace distribution.) |
s , d |
s , d |
Laplace distribution (double exponential distribution) |
vRngWeibull (Generates Weibull distributed random numbers.) |
s , d |
s , d |
Weibull distribution |
vRngCauchy (Generates Cauchy distributed random values.) |
s , d |
s , d |
Cauchy distribution |
vRngRayleigh (Generates Rayleigh distributed random values.) |
s , d |
s , d |
Rayleigh distribution |
vRngLognormal (Generates lognormally distributed random numbers.) |
s , d |
s , d |
Lognormal distribution |
vRngGumbel (Generates Gumbel distributed random values.) |
s , d |
s , d |
Gumbel (extreme value) distribution |
vRngGamma (Generates gamma distributed random values.) |
s , d |
s , d |
Gamma distribution |
vRngBeta (Generates gamma distributed random values.) |
s , d |
s , d |
Beta distribution |
vRngChiSquare (Generates chi-square distributed random values.) |
s , d |
s , d |
Chi-Square distribution |
Discrete Distribution Generators Type of Distribution |
Data Types |
BRNG Data Type |
Description |
|---|---|---|---|
vRngUniform (Generates random numbers uniformly distributed over the interval [a, b).) |
i |
d |
Uniform discrete distribution on the interval [ a,b ) |
vRngUniformBits (Generates bits of underlying BRNG integer recurrence.) |
i |
i |
Underlying BRNG integer recurrence |
vRngUniformBits32 (Generates uniformly distributed bits in 32-bit chunks.) |
i |
i |
Uniformly distributed bits in 32-bit chunks |
vRngUniformBits64 (Generates uniformly distributed bits in 64-bit chunks.) |
i |
i |
Uniformly distributed bits in 64-bit chunks |
vRngBernoulli (Generates Bernoulli distributed random values.) |
i |
s |
Bernoulli distribution |
vRngGeometric (Generates geometrically distributed random values.) |
i |
s |
Geometric distribution |
vRngBinomial (Generates binomially distributed random numbers.) |
i |
d |
Binomial distribution |
vRngHypergeometric (Generates hypergeometrically distributed random values.) |
i |
d |
Hypergeometric distribution |
vRngPoisson (Generates Poisson distributed random values.) |
i |
s (for VSL_RNG_METHOD_POISSON_POISNORM ) s (for distribution parameter λ ≥ 27) and d (for λ < 27) (for VSL_RNG_METHOD_POISSON_PTPE ) |
Poisson distribution |
vRngPoisson (Generates Poisson distributed random values with varying mean.) |
i |
s |
Poisson distribution with varying mean |
vRngNegBinomial (Generates random numbers with negative binomial distribution.) |
i |
d |
Negative binomial distribution, or Pascal distribution |
vRngMultinomial (Generates multinomially distributed random numbers.) |
i |
d |
Multinomial distribution |
Modes of random number generation
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 guarantees 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 |
|---|---|
vRngUniform (Generates random numbers with uniform distribution.) |
s , d |
vRngExponential (Generates exponentially distributed random numbers.) |
s , d |
vRngWeibull (Generates Weibull distributed random numbers.) |
s , d |
vRngRayleigh (Generates Rayleigh distributed random values.) |
s , d |
vRngLognormal (Generates lognormally distributed random numbers.) |
s , d |
vRngGamma (Generates gamma distributed random values.) |
s , d |
vRngBeta (Generates gamma distributed random values.) |
s , d |
See additional details about accurate and fast mode of random number generation in [VSNotes] .
New method names
The current version of oneMKL has a modified structure of VS RNG method names. (See RNG Naming Conventions for details.) The old names are kept for backward compatibility. The tables below set correspondence between the new and legacy method names for VS random number generators.
RNG |
Legacy Method Name |
New Method Name |
|---|---|---|
vRngUniform (Generates random numbers with uniform distribution.) |
VSL_METHOD_SUNIFORM_STD , VSL_METHOD_DUNIFORM_STD , VSL_METHOD_SUNIFORM_STD_ACCURATE , VSL_METHOD_DUNIFORM_STD_ACCURATE |
VSL_RNG_METHOD_UNIFORM_STD , VSL_RNG_METHOD_UNIFORM_STD_ACCURATE |
vRngGaussian (Generates normally distributed random numbers.) |
VSL_METHOD_SGAUSSIAN_BOXMULLER , VSL_METHOD_SGAUSSIAN_BOXMULLER2 , VSL_METHOD_SGAUSSIAN_ICDF , VSL_METHOD_DGAUSSIAN_BOXMULLER , VSL_METHOD_DGAUSSIAN_BOXMULLER2 , VSL_METHOD_DGAUSSIAN_ICDF |
VSL_RNG_METHOD_GAUSSIAN_BOXMULLER , VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2 , VSL_RNG_METHOD_GAUSSIAN_ICDF |
vRngGaussianMV (Generates random numbers from multivariate normal distribution.) |
VSL_METHOD_SGAUSSIANMV_BOXMULLER , VSL_METHOD_SGAUSSIANMV_BOXMULLER2 , VSL_METHOD_SGAUSSIANMV_ICDF , VSL_METHOD_DGAUSSIANMV_BOXMULLER , VSL_METHOD_DGAUSSIANMV_BOXMULLER2 , VSL_METHOD_DGAUSSIANMV_ICDF |
VSL_RNG_METHOD_GAUSSIANMV_BOXMULLER , VSL_RNG_METHOD_GAUSSIANMV_BOXMULLER2 , VSL_RNG_METHOD_GAUSSIANMV_ICDF |
vRngExponential (Generates exponentially distributed random numbers.) |
VSL_METHOD_SEXPONENTIAL_ICDF , VSL_METHOD_DEXPONENTIAL_ICDF , VSL_METHOD_SEXPONENTIAL_ICDF_ACCURATE , VSL_METHOD_DEXPONENTIAL_ICDF_ACCURATE |
VSL_RNG_METHOD_EXPONENTIAL_ICDF , VSL_RNG_METHOD_EXPONENTIAL_ICDF_ACCURATE |
vRngLaplace (Generates random numbers with Laplace distribution.) |
VSL_METHOD_SLAPLACE_ICDF , VSL_METHOD_DLAPLACEL_ICDF |
VSL_RNG_METHOD_LAPLACE_ICDF |
vRngWeibull (Generates Weibull distributed random numbers.) |
VSL_METHOD_SWEIBULL_ICDF , VSL_METHOD_DWEIBULL_ICDF , VSL_METHOD_SWEIBULL_ICDF_ACCURATE , VSL_METHOD_DWEIBULL_ICDF_ACCURATE |
VSL_RNG_METHOD_WEIBULL_ICDF , VSL_RNG_METHOD_WEIBULL_ICDF_ACCURATE |
vRngCauchy (Generates Cauchy distributed random values.) |
VSL_METHOD_SCAUCHY_ICDF , VSL_METHOD_DCAUCHY_ICDF |
VSL_RNG_METHOD_CAUCHY_ICDF |
vRngRayleigh (Generates Rayleigh distributed random values.) |
VSL_METHOD_SRAYLEIGH_ICDF , VSL_METHOD_DRAYLEIGH_ICDF , VSL_METHOD_SRAYLEIGH_ICDF_ACCURATE , VSL_METHOD_DRAYLEIGH_ICDF_ACCURATE |
VSL_RNG_METHOD_RAYLEIGH_ICDF , VSL_RNG_METHOD_RAYLEIGH_ICDF_ACCURATE |
vRngLognormal (Generates lognormally distributed random numbers.) |
VSL_METHOD_SLOGNORMAL_BOXMULLER2 , VSL_METHOD_DLOGNORMAL_BOXMULLER2 , VSL_METHOD_SLOGNORMAL_BOXMULLER2_ACCURATE , VSL_METHOD_DLOGNORMAL_BOXMULLER2_ACCURATE |
VSL_RNG_METHOD_LOGNORMAL_BOXMULLER2 , VSL_RNG_METHOD_LOGNORMAL_BOXMULLER2_ACCURATE |
VSL_METHOD_SLOGNORMAL_ICDF , VSL_METHOD_DLOGNORMAL_ICDF , VSL_METHOD_SLOGNORMAL_ICDF_ACCURATE , VSL_METHOD_DLOGNORMAL_ICDF_ACCURATE |
VSL_RNG_METHOD_LOGNORMAL_ICDF , VSL_RNG_METHOD_LOGNORMAL_ICDF_ACCURATE |
|
vRngGumbel (Generates Gumbel distributed random values.) |
VSL_METHOD_SGUMBEL_ICDF , VSL_METHOD_DGUMBEL_ICDF |
VSL_RNG_METHOD_GUMBEL_ICDF |
vRngGamma (Generates gamma distributed random values.) |
VSL_METHOD_SGAMMA_GNORM , VSL_METHOD_DGAMMA_GNORM , VSL_METHOD_SGAMMA_GNORM_ACCURATE , VSL_METHOD_DGAMMA_GNORM_ACCURATE |
VSL_RNG_METHOD_GAMMA_GNORM , VSL_RNG_METHOD_GAMMA_GNORM_ACCURATE |
vRngBeta (Generates beta distributed random values.) |
VSL_METHOD_SBETA_CJA , VSL_METHOD_DBETA_CJA , VSL_METHOD_SBETA_CJA_ACCURATE , VSL_METHOD_DBETA_CJA_ACCURATE |
VSL_RNG_METHOD_BETA_CJA , VSL_RNG_METHOD_BETA_CJA_ACCURATE |
RNG |
Legacy Method Name |
New Method Name |
|---|---|---|
vRngUniform (Generates random numbers uniformly distributed over the interval [a, b).) |
VSL_METHOD_IUNIFORM_STD |
VSL_RNG_METHOD_UNIFORM_STD |
vRngUniformBits (Generates bits of underlying BRNG integer recurrence.) |
VSL_METHOD_IUNIFORMBITS_STD |
VSL_RNG_METHOD_UNIFORMBITS_STD |
vRngBernoulli (Generates Bernoulli distributed random values.) |
VSL_METHOD_IBERNOULLI_ICDF |
VSL_RNG_METHOD_BERNOULLI_ICDF |
vRngGeometric (Generates geometrically distributed random values.) |
VSL_METHOD_IGEOMETRIC_ICDF |
VSL_RNG_METHOD_GEOMETRIC_ICDF |
vRngBinomial (Generates binomially distributed random numbers.) |
VSL_METHOD_IBINOMIAL_BTPE |
VSL_RNG_METHOD_BINOMIAL_BTPE |
vRngHypergeometric (Generates hypergeometrically distributed random values.) |
VSL_METHOD_IHYPERGEOMETRIC_H2PE |
VSL_RNG_METHOD_HYPERGEOMETRIC_H2PE |
vRngPoisson (Generates Poisson distributed random values.) |
VSL_METHOD_IPOISSON_PTPE , VSL_METHOD_IPOISSON_POISNORM |
VSL_RNG_METHOD_POISSON_PTPE , VSL_RNG_METHOD_POISSON_POISNORM |
vRngPoissonV (Generates Poisson distributed random values with varying mean.) |
VSL_METHOD_IPOISSONV_POISNORM |
VSL_RNG_METHOD_POISSONV_POISNORM |
vRngNegBinomial (Generates random numbers with negative binomial distribution.) |
VSL_METHOD_INEGBINOMIAL_NBAR |
VSL_RNG_METHOD_NEGBINOMIAL_NBAR |