# Random Number Generators (RNG)#

Definitions

The pseudo-random number generator is defined by a structure($$S$$, $$\mu$$, $$f$$, $$U$$, $$g$$), where:

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

• $$\mu$$ is a probability distribution on $$S$$ for the initial state (or seed) $$s_0$$

• $$f:S \rightarrow S$$ is the transition function

• $$U$$ – a finite set of output symbols

• $$g:S \rightarrow U$$ an output function

The generation of random numbers is as follows:

1. Generate the initial state (called the seed) $$s_0$$ according to $$\mu$$ and compute $$u_0 = g(s_0)$$.

2. Iterate for $$i = 1 , ... ,  :math:s_i = f(s_{i-1})$$ and $$u_i = g(s_i)$$. Output values $$u_i$$ 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.

Execution Models

RNG domain supports two execution models:

1. Host API, which is aligned with the rest of oneMKL domains oneMKL domains.

2. Device API, which is specific for RNG domain. These APIs are designed to be callable from the User’s kernels as well as Host code.

Parent topic: Random Number Generators