mrg32k3a#

The combined multiple recursive pseudorandom number generator MRG32k3a.

Description

MRG32k3a engine is a 32-bit combined multiple recursive generator with two components of order 3 [L’Ecuyer99a]. MRG32k3a combined generator meets the requirements for modern RNGs, such as good multidimensional uniformity, or a long period (\(p \approx 2^{191}\)).

Generation algorithm

\(x_n=a_{11} x_{n-1} + a_{12} x_{n-2} + a_{13} x_{n-3}(mod \ m_{1})\)

\(y_n = a_{21} y_{n-1} + a_{22} y_{n-2} + a_{23} (mod \ m_2)\)

\(z_n = x_n - y_n (mod \ m_{1})\)

\(u_n = z_n / m_1\)

\(a_{11} = 0, a_{12} = 1403580, a_{13} = -810728, m_1 = 2^{32} - 209\)

\(a_{21} = 527612, a_{22} = 0, a_{23} = -1370589, m_2 = 2^{32} - 22853\)

class mrg32k3a#

Syntax

namespace oneapi::mkl::rng {
class mrg32k3a {
public:
    static constexpr std::uint32_t default_seed = 1;

    mrg32k3a(sycl::queue queue, std::uint32_t seed = default_seed);

    mrg32k3a(sycl::queue queue, std::initializer_list<std::uint32_t> seed);

    mrg32k3a(const mrg32k3a& other);

    mrg32k3a(mrg32k3a&& other);

    mrg32k3a& operator=(const mrg32k3a& other);

    mrg32k3a& operator=(mrg32k3a&& other);

    ~mrg32k3a();
};
}

Class Members

Routine

Description

mrg32k3a(sycl::queue queue, std::uint32_t seed = default_seed)

Constructor for common seed initialization of the engine

mrg32k3a(sycl::queue queue, std::initializer_list<std::uint32_t> seed)

Constructor for extended seed initialization of the engine

mrg32k3a(const mrg32k3a& other)

Copy constructor

mrg32k3a(mrg32k3a&& other)

Move constructor

mrg32k3a& operator=(const mrg32k3a& other)

Copy assignment operator

mrg32k3a& operator=(mrg32k3a&& other)

Move assignment operator

Constructors

mrg32k3a::mrg32k3a(sycl::queue queue, std::uint32_t seed = default_seed)

Input Parameters

queue

Valid sycl::queue object, calls of the oneapi::mkl::rng::generate() routine submits kernels in this queue to obtain random numbers from a given engine.

seed

The initial conditions of the generator state, assume \(x_{-3} = seed \ mod \ m_1, x_{-2} = x_{-1} = y_{-3} = y_{-2} = y_{-1} = 1\).

mrg32k3a::mrg32k3a(sycl::queue queue, std::initializer_list<std::uint32_t> seed)

Input Parameters

queue

Valid sycl::queue object, calls of the oneapi::mkl::rng::generate() routine submits kernels in this queue to obtain random numbers from a given engine.

seed

The initial conditions of the generator state, assume if \(n = 0: x_{-3} = x_{-2} = x_{-1} = y_{-3} = y_{-2} = y_{-1} = 1\)

if \(n = 1: x_{-3} = seed[0] \ mod \ m_1, x_{-2} = x_{-1} = y_{-3} = y_{-2} = y_{-1} = 1\)

if \(n = 2: x_{-3} = seed[0] \ mod \ m_1, x_{-2} = seed[1] \ mod \ m_1, x_{-1} = y_{-3} = y_{-2} = y_{-1} = 1\)

if \(n = 3: x_{-3} = seed[0] \ mod \ m_1, x_{-2} = seed[1] \ mod \ m_1, x_{-1} = seed[2] \ mod \ m_1\)

\(y_{-3} = y_{-2} = y_{-1} = 1\)

if \(n = 4: x_{-3} = seed[0] \ mod \ m_1, x_{-2} = seed[1] \ mod \ m_1, x_{-1} = seed[2] \ mod \ m_1\)

\(y_{-3} = seed[3] \ mod \ m_2, y_{-2} = y_{-1} = 1\)

if \(n = 5: x_{-3} = seed[0] \ mod \ m_1, x_{-2} = seed[1] \ mod \ m_1, x_{-1} = seed[2] \ mod \ m_1\)

\(y_{-3} = seed[3] \ mod \ m_2, y_{-2} = seed[4] \ mod \ m_2, y_{-1} = 1\)

if \(n \geqslant 6: x_{-3} = seed[0] \ mod \ m_1, x_{-2} = seed[1] \ mod \ m_1, x_{-1} = seed[2] \ mod \ m_1\)

\(y_{-3} = seed[3] \ mod \ m_2, y_{-2} = seed[4] \ mod \ m_2, y_{-1} = seed[5] \ mod \ m_2\)

if the values prove to be \(x_{-3} = x_{-2} = x_{-1} = 0\), assume \(x_{-3} = 1\)

if the values prove to be \(y_{-3} = y_{-2} = y_{-1} = 0\), assume \(y_{-3} = 1\)

mrg32k3a::mrg32k3a(const mrg32k3a& other)

Input Parameters

other

Valid mrg32k3a object. The queue and state of the other engine is copied and applied to the current engine.

mrg32k3a::mrg32k3a(mrg32k3a&& other)

Input Parameters

other

Valid mrg32k3a object. The queue and state of the other engine is moved to the current engine.

mrg32k3a::mrg32k3a& operator=(const mrg32k3a& other)

Input Parameters

other

Valid mrg32k3a object. The queue and state of the other engine is copied and applied to the current engine.

mrg32k3a::mrg32k3a& operator=(mrg32k3a&& other)

Input Parameters

other

Valid mrg32k3a r-value object. The queue and state of the other engine is moved to the current engine.

Parent topic: Host Engines (Basic Random Number Generators)