mrg32k3a

Contents

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 (p2191).

Generation algorithm

xn=a11xn1+a12xn2+a13xn3(mod m1)

yn=a21yn1+a22yn2+a23(mod m2)

zn=xnyn(mod m1)

un=zn/m1

a11=0,a12=1403580,a13=810728,m1=232209

a21=527612,a22=0,a23=1370589,m2=23222853

class mrg32k3a#

Syntax

namespace oneapi::math::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::math::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 x3=seed mod m1,x2=x1=y3=y2=y1=1.

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

Input Parameters

queue

Valid sycl::queue object, calls of the oneapi::math::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:x3=x2=x1=y3=y2=y1=1

if n=1:x3=seed[0] mod m1,x2=x1=y3=y2=y1=1

if n=2:x3=seed[0] mod m1,x2=seed[1] mod m1,x1=y3=y2=y1=1

if n=3:x3=seed[0] mod m1,x2=seed[1] mod m1,x1=seed[2] mod m1

y3=y2=y1=1

if n=4:x3=seed[0] mod m1,x2=seed[1] mod m1,x1=seed[2] mod m1

y3=seed[3] mod m2,y2=y1=1

if n=5:x3=seed[0] mod m1,x2=seed[1] mod m1,x1=seed[2] mod m1

y3=seed[3] mod m2,y2=seed[4] mod m2,y1=1

if n6:x3=seed[0] mod m1,x2=seed[1] mod m1,x1=seed[2] mod m1

y3=seed[3] mod m2,y2=seed[4] mod m2,y1=seed[5] mod m2

if the values prove to be x3=x2=x1=0, assume x3=1

if the values prove to be y3=y2=y1=0, assume y3=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)