Visible to Intel only — GUID: GUID-93E890AA-3C34-42C4-8446-37E75BC5A57B
Visible to Intel only — GUID: GUID-93E890AA-3C34-42C4-8446-37E75BC5A57B
oneapi::mkl::rng::device::uniform (Discrete)
Generates random numbers uniformly distributed over the interval [a, b).
Description
The oneapi::mkl::rng::device::uniform class object is used in oneapi::mkl::rng::device::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, b∈Z; a < b.
The probability distribution is given by:
![](/content/dam/docs/us/en/developer-reference-dpcpp/2023-0/9C153EE4-E2C3-4115-BB40-E10A6C513317-low.png)
The cumulative distribution function is as follows:
![](/content/dam/docs/us/en/developer-reference-dpcpp/2023-0/997AE5DA-ADB6-4EAB-8536-8B4EC7AB53EE-low.png)
API
Syntax
template<typename Type, typename Method> class uniform<std::(u)int32_t, Method> { public: using method_type = Method; using result_type = Type; uniform(): uniform((Type)0, std::is_same<Method, uniform_method::standard>::value ? (1 << 23) : std::numeric_limits<Type>::max()){}; explicit uniform(Type a, Type b); explicit uniform(const param_type& pt); Type a() const; Type b() const; param_type param() const; void param(const param_type& pt); };
Include Files
oneapi/mkl/rng/device.hpp
Template Parameters
typename Method |
Generation method. The specific values are as follows: oneapi::mkl::rng::device::uniform_method::standard oneapi::mkl::rng::device::uniform_method::accurate See brief descriptions of the methods in Distributions Template Parameter Method. |
![](/content/dam/docs/us/en/developer-reference-dpcpp/2023-0/A1C9984D-41F7-4DAD-945C-1DCE4AAF589A-low.png)
Input Parameters
Name |
Type |
Description |
---|---|---|
c |
std::int32_t std::uint32_t |
Left bound a |
d |
std::int32_t std::uint32_t |
Right bound b |