mkl::rng::uniform (Discrete)

Generates random numbers uniformly distributed over the interval [a, b).

Syntax

template<typename Method>

class uniform<std::int32_t, Method> {

public:

using method_type = Method;

using result_type = std::int32_t;

uniform(): uniform(0, std::numeric_limits<std::int32_t>::max()){};

explicit uniform(std::int32_t a, std::int32_t b);

explicit uniform(const uniform<std::int32_t, mkl::rng::standard>& other);

std::int32_t a() const;

std::int32_t b() const;

uniform<std::int32_t, mkl::rng::standard>& operator=(const uniform<std::int32_t, mkl::rng::standard>& other);

};

Devices supported: Host, CPU, and GPU.

Include Files

Description

The mkl::rng::uniform class object is used in mkl::rng::generate functions to provide random numbers uniformly distributed over the interval [a, b), where a, b are the left and right bounds of the interval respectively, and a, bZ; a < b.

The probability distribution is given by:


Equation

The cumulative distribution function is as follows:


Equation

Template Parameters

typename Method = mkl::rng::uniform_method::by_default

Generation method. The specific values are as follows:

mkl::rng::uniform_method::standard

See brief descriptions of the methods in Distributions Template Parameter Method Values

Input Parameters

Name

Type

Description

a

std::int32_t

Left bound a

b

std::int32_t

Right bound b