Distributions

Distributions#

oneMKL RNG 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. The following tables 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.

Type of Distribution

Data Types

BRNG Data Type

Description

uniform (Continuous)

float, double

float, double

Uniform continuous distribution on the interval [a,b)

gaussian

float, double

float, double

Normal (Gaussian) distribution

gaussian_mv

float, double

float, double

Normal (Gaussian) multivariate distribution

exponential

float, double

float, double

Exponential distribution

laplace

float, double

float, double

Laplace distribution (double exponential distribution)

weibull

float, double

float, double

Weibull distribution

cauchy

float, double

float, double

Cauchy distribution

rayleigh

float, double

float, double

Rayleigh distribution

lognormal

float, double

float, double

Lognormal distribution

gumbel

float, double

float, double

Gumbel (extreme value) distribution

gamma

float, double

float, double

Gamma distribution

gamma

float, double

float, double

Beta distribution

chi_square

float, double

float, double

Chi-Square distribution

Type of Distribution

Data Types

BRNG Data Type

Description

uniform (Discrete)

integer

GPU:

float for oneapi::mkl::rng::uniform_method::standard,

double for oneapi::mkl::rng::method::accurate

CPU:

double for both methods

Uniform discrete distribution on the interval [a,b)

uniform_bits

integer

integer

Uniformly distributed bits in 32-bit chunks

integer

integer

Uniformly distributed bits in 64-bit chunks

bits

integer

integer

Bits of underlying BRNG integer sequence

bernoulli

integer

float

Bernoulli distribution

geometric

integer

float

Geometric distribution

binomial

integer

double

Binomial distribution

hypergeometric

integer

double

Hypergeometric distribution

poisson

integer

float (for ) oneapi::mkl::rng::poisson_method::gaussian_icdf_based float (for distribution parameter \(\lambda \ge 27\)) and double (for \(\lambda < 27\)) (for oneapi::mkl::rng::poisson_method::ptpe)

Poisson distribution

poisson_v

integer

double

Poisson distribution with varying mean

negative_binomial

integer

double

Negative binomial distribution, or Pascal distribution

multinomial

integer

CPU - float GPU - double

Multinomial distribution

NOTE: In case of integer check desired distribution for supported data types.

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

Distribution Method

uniform (Discrete)

oneapi::mkl::rng::unform_method::accurate

exponential

oneapi::mkl::rng::exponential_method::icdf_accurate

weibull

oneapi::mkl::rng::weibull_method::icdf_accurate

rayleigh

oneapi::mkl::rng::rayleigh_method::icdf_accurate

lognormal

oneapi::mkl::rng::lognormal_method::icdf_accurate oneapi::mkl::rng::lognormal_method::box_muller2_accurate

gamma

oneapi::mkl::rng::gamma_method::marsaglia_accurate

gamma

oneapi::mkl::rng::beta_method::cja_accurate