sfmt19937

Contents

sfmt19937#

The SIMD-oriented Mersenne Twister pseudorandom number generator.

Description

SIMD-oriented Fast Mersenne Twister pseudorandom number generator SFMT19937 [Saito08] with a period length equal to \(2 ^ {19937}-1\) of the produced sequence. The state of the engine contains the array of 156 128-bit integers.

Generation algorithm

\(w_n = w_0 A \oplus w_M B \oplus w_{n-2} C \oplus w_{n-1} D\)

Where \(w_0, w_M, w_{n-2}, ...\) are the 128-bit integers, and \(wA, wB, wC, wD\) operations are defined as follows:

\(wA = (w << 8) \oplus w\), left shift of 128-bit integer \(w\) by \(a\) followed by exclusive-or operation

\(wB = (w >> 8) \& mask\), right shift of each 32-bit integer in quadruple \(w\) by and-operator with quadruple of 32-bit masks \(mask = (0xBFFFFFF6, 0xDFFAFFFF, 0xDDFECB7F, 0xDFFFFFEF)\)

\(wC = (w >> 8) \oplus w\), right shift of 128-bit integer \(w\)

\(wD = (w << 8)\), left shift of each 32-bit integer in quadruple \(w\)

Integer output: \(r_{4n+k} = w_{n}(k)\), where \(w_{n}(k)\) is the k-th 32-bit integer in quadruple \(w_{n}, k = 0, 1, 2, 3\)

\(u_n = (int) r_n / 2^{32} + 1/2\)

class sfmt19937#

Syntax

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

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

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

    sfmt19937(const sfmt19937& other);

    sfmt19937(sfmt19937&& other);

    sfmt19937& operator=(const sfmt19937& other);

    sfmt19937& operator=(sfmt19937&& other);

    ~sfmt19937();
};
}

Class Members

Routine

Description

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

Constructor for common seed initialization of the engine

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

Constructor for extended seed initialization of the engine

sfmt19937(const sfmt19937& other)

Copy constructor

sfmt19937(sfmt19937&& other)

Move constructor

sfmt19937& operator=(const sfmt19937& other)

Copy assignment operator

sfmt19937& operator=(sfmt19937&& other)

Move assignment operator

Constructors

sfmt19937::sfmt19937(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. The initialization algorithm described in [Saito08].

sfmt19937::sfmt19937(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. The initialization algorithm described in [Saito08].

sfmt19937::sfmt19937(const sfmt19937& other)

Input Parameters

other

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

sfmt19937::sfmt19937(sfmt19937&& other)

Input Parameters

other

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

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

Input Parameters

other

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

sfmt19937::sfmt19937& operator=(sfmt19937&& other)

Input Parameters

other

Valid sfmt19937 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)