Visible to Intel only — GUID: GUID-F329031A-7555-4F68-ACC7-2D62F46FB102
Visible to Intel only — GUID: GUID-F329031A-7555-4F68-ACC7-2D62F46FB102
oneapi::mkl::rng::uniform (Discrete)
Generates random numbers uniformly distributed over the interval [a, b).
Description
The oneapi::mkl::rng::uniform class object is used in oneapi::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, b∈Z; a < b.
The probability distribution is given by:
![](/content/dam/docs/us/en/developer-reference-dpcpp/2023-1/0C1EFCCE-60AA-42D3-8135-683895F13BEF-low.png)
The cumulative distribution function is as follows:
![](/content/dam/docs/us/en/developer-reference-dpcpp/2023-1/C9B41B2A-C865-46B7-A267-7B9E961EEF47-low.png)
API
Syntax
template<typename Method> class uniform<std::(u)int32_t, Method> { public: using method_type = Method; using result_type = std::(u)int32_t; uniform(): uniform((std::(u)int32_t )(0), std::is_same<Method, uniform_method::standard>::value ? (1 << 23) :std::numeric_limits<Type>::max()){} explicit uniform(std::(u)int32_t a, std::(u)int32_t b); explicit uniform(const param_type& pt); std::(u)int32_t a() const; std::(u)int32_t b() const; param_type param() const; void param(const param_type& pt); };
Devices supported: CPU and GPU.
Include Files
oneapi/mkl/rng.hpp
Template Parameters
typename Method = oneapi::mkl::rng::uniform_method::by_default |
Generation method. The specific values are as follows: oneapi::mkl::rng::uniform_method::standard oneapi::mkl::rng::uniform_method::accurate See brief descriptions of the methods in Distributions Template Parameter Method. |
![](/content/dam/docs/us/en/developer-reference-dpcpp/2023-1/59696993-52EC-4503-A09D-16BF6F44CF74-low.png)
Input Parameters
Name |
Type |
Description |
---|---|---|
a |
std::int32_t std::uint32_t |
Left bound a |
b |
std::int32_t std::uint32_t |
Right bound b |