Random Number Generators

Intel® oneAPI Math Kernel Library (oneMKL) provides Data Parallel C++ interfaces for the Vector Statistics Random Number Generators (RNG) routines implementing commonly used pseudorandom, quasi-random, and non-deterministic generators with continuous and discrete distributions.

oneMKL RNG includes manual offload functionality similar to other domains (Random Number Generator Routines) and also device functionality—a set of functions callable directly from DPC++ kernels (refer to Random Number Generators Device Routines for detailed descriptions).


Pseudo-random number generator is defined by a structure(S, μ, f, U, g), where:

  • S is a finite set of states (the state space)

  • μ is a probability distribution on S for the initial state (or seed) s0

  • f:S→S is the transition function

  • U – a finite set of output symbols

  • g∶S→U an output function

The generation of random numbers is as follows:

  1. Generate the initial state (called the seed) s0 according to μ and compute u0=g(s0).

  2. Iterate for i=1,…,si = f(s(``i`-1)`) and ui = g(si). Output values ui are the so-called random numbers produced by the PRNG.

In computational statistics, random variate generation is usually made in two steps:

  1. Generating imitations of independent and identically distributed (i.i.d.) random variables having the uniform distribution over the interval (0, 1)

  2. Applying transformations to these i.i.d. U(0, 1) random variates in order to generate (or imitate) random variates and random vectors from arbitrary distributions.

All RNG routines can be classified into several categories:

  • Engines (Basic random number generators) classes, which holds state of generator and is a source of i.i.d. random variables.

  • Transformation classes for different types of statistical distributions, for example, uniform, normal (Gaussian), binomial, etc. These classes contain all of the distribution’s parameters (including generation method).

  • Generate function. The current routine is used to obtain random numbers from a given engine with proper statistics defined by a given distribution.

  • Service routines to modify the engine state: skip ahead and leapfrog functions.