Visible to Intel only — GUID: GUID-9EB1EF84-18A9-41F7-B724-81F8D896ED4E
Visible to Intel only — GUID: GUID-9EB1EF84-18A9-41F7-B724-81F8D896ED4E
uniform (Continuous)
Generates random numbers with uniform distribution.
Description
The class object is used in generate function 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 .
The probability density function is given by:
![](/content/dam/docs/us/en/developer-reference-dpcpp/2024-1/0FC0D71B-6D25-40E2-B5DC-86467C4E7BEA-low.png)
The cumulative distribution function is as follows:
![](/content/dam/docs/us/en/developer-reference-dpcpp/2024-1/81C97CCB-6FAA-4BC7-BB7B-E6B0A3219879-low.png)
API
Syntax
namespace oneapi::mkl::rng {
template<typename Type = float,
typename Method = uniform_method::by_default>
class uniform {
public:
using method_type = Method;
using result_type = Type;
uniform(): uniform(static_cast<Type>(0.0), static_cast<Type>(1.0)){}
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);
};
}
Devices supported: CPU and GPU.
Include Files
oneapi/mkl/rng.hpp
Template Parameters
typename Type = float |
Type of the produced values. The specific values are as follows: float double |
typename Method = oneapi::mkl::rng::uniform_method::by_default |
Generation method. The specific values are as follows: oneapi::mkl::rng::uniform_method::standardoneapi::mkl::rng::uniform_method::accurate See brief descriptions of the methods in Distributions Template Parameter Method |
Input Parameters
Name |
Type |
Description |
---|---|---|
a |
Type (float, double) |
Left bound a |
b |
Type (float, double) |
Right bound b |