mcg59

Contents

mcg59#

The 59-bit multiplicative congruential pseudorandom number generator MCG(\(13^{13}, 2^{59}\)) from NAG Numerical Libraries.

Description

The mcg59 engine is a 59-bit multiplicative congruential generator from NAG Numerical Libraries NAG. The mcg59 generator belongs to linear congruential generators with the period length of approximately \(2^{57}\).

Generation algorithm

\(x_n=ax_{n-1}(mod \ m)\)

\(u_n = x_n / m\)

\(a = 13^{13}, m=2^{59}\)

class mcg59#

Syntax

namespace oneapi::math::rng::device {
  template<std::int32_t VecSize = 1>
  class mcg59 {
  public:
    static constexpr std::uint32_t default_seed = 1;
    static constexpr std::int32_t vec_size = VecSize;

    mcg59();
    mcg59(std::uint64_t seed, std::uint64_t offset = 0);
  };
}

Class Template Parameters

VecSize

Describes the size of vector which will be produced by generate function by this engine. VecSize values may be 1, 2, 3, 4, 8, 16 as sycl::vec class size. By default VecSize = 1, for this case, a single random number is returned by the generate function.

Class Members

Routine

Description

mcg59()

Default constructor

mcg59(std::uint64_t seed, std::uint64_t offset = 0)

Constructor for common seed initialization of the engine and common number of skipped elements

Constructors

mcg59::mcg59()
mcg59::mcg59(std::uint64_t seed, std::uint64_t offset = 0)

Input Parameters

seed

The initial conditions of the generator state, assume \(x_0 = seed \ mod \ 2^{59}\), if \(x_0 = 0\), assume \(x_0 = 1\).

offset

Number of skipped elements.

Parent topic: Device Engines (Basic Random Number Generators)