ars5#

The ars5 counter-based pseudorandom number generator.

Description

The ars5 engine is a keyed family of counter-based BRNG. The state consists of a 128-bit integer counter \(c\) and a 128-bit key \(k\). The BRNG is based on the AES encryption algorithm [FIPS-197].

Generation algorithm

The generator has a 32-bit integer output obtained in the following way [Salmon11]:

  1. The i-th number is defined by the following formula \(r_i=(f(i/ 4) >> ((i \ mod \ 4) * 32)) \ mod \ 2 ^ {32}\)

  2. Function \(f(c)\) takes a 128-bit argument and returns a 128-bit number. The returned number is obtained as follows:

    2.1. \(c_0 = c \oplus k\) and \(k_0 = k\).

    2.2. The following recurrence is calculated N = 5 times:

    \(c_{i+1} = SubBytes(c)\)

    \(c_{i+1} = ShiftRows(c_{i+1})\)

    \(c_{i+1} = MixColumns(c_{i+1})\), this step is omitted if \(i+1 = N\)

    \(c_{i+1} = AddRoundKey(c_{i+1}, k_j)\)

    \(Lo(k_{i+1}) = Lo(k) + 0x9E3779B97F4A7C15\)

    \(Hi(k_{i+1}) = Hi(k) + 0xBB67AE8584CAA73B\)

    Specification for \(SubBytes, ShiftRows, MixColumns, AddRoundKey\) functions can be found in [FIPS-197].

    2.3. Put \(f(c) = c_N\), where \(N = 10\)

  3. Real output: \(u_n=(int)r_n / 2^{32} + 1/2\)

class ars5#

Syntax

namespace oneapi::mkl::rng {
class ars5 {
public:
        static constexpr std::uint64_t default_seed = 0;

        ars5(sycl::queue queue, std::uint64_t seed = default_seed);

        ars5(sycl::queue queue, std::initializer_list<std::uint64_t> seed);

        ars5(const ars5& other);

        ars5(ars5&& other);

        ars5& operator=(const ars5& other);

        ars5& operator=(ars5&& other);

        ~ars5();
};
}

Class Members

Routine

Description

ars5(sycl::queue queue, std::uint64_t seed)

Constructor for common seed initialization of the engine

ars5(sycl::queue queue, std::initializer_list<std::uint64_t> seed)

Constructor for extended seed initialization of the engine

ars5(const ars5& other)

Copy constructor

ars5(ars5&& other)

Move constructor

ars5& operator=(const ars5& other)

Copy assignment operator

ars5& operator=(ars5&& other)

Move assignment operator

Constructors

ars5::ars5(sycl::queue queue, std::uint64_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 \(k = seed, c = 0\), where \(k\) is 128-bit key, \(c\) is 128-bit counter.

ars5::ars5(sycl::queue queue, std::initializer_list<std::uint64_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: k = 0, c = 0\)

if \(n = 1: k = seed[0], c = 0\)

if \(n = 2: k = seed[0] + seed[1] \cdot 2^{64}, c = 0\)

if \(n = 3: k = seed[0] + seed[1] \cdot 2^{64}, c = seed[2]\)

if \(n = 4: k = seed[0] + seed[1] \cdot 2^{64}, c = seed[2] + seed[3] \cdot 2^{64}\)

for \(n > 4\) following arguments are ignored

ars5::ars5(const ars5& other)

Input Parameters

other

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

ars5::ars5(ars5&& other)

Input Parameters

other

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

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

Input Parameters

other

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

ars5::ars5& operator=(ars5&& other)

Input Parameters

other

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