Visible to Intel only — GUID: GUID-31840494-958A-4E5F-A560-AF5EABD0224B
Visible to Intel only — GUID: GUID-31840494-958A-4E5F-A560-AF5EABD0224B
uniform (Continuous)
Generates random numbers with uniform distribution.
Description
The uniform class object is used in the 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 a, b∈R ; a < b.
The probability density function is given by:
![](/content/dam/docs/us/en/developer-reference-dpcpp/2024-2/E8C5A7AF-8288-4629-B63E-DABFECB86A6A-low.png)
The cumulative distribution function is as follows:
![](/content/dam/docs/us/en/developer-reference-dpcpp/2024-2/58736452-0663-44CE-9ED8-C3723B6AF385-low.png)
API
Syntax
namespace oneapi::mkl::rng::device {
template<typename Type, typename Method>
class uniform {
public:
using method_type = Method;
using result_type = Type;
uniform(): uniform((Type)0.0, (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);
};
}
Include Files
oneapi/mkl/rng/device.hpp
Template Parameters
typename Type |
Type of the produced values. The specific values are as follows:
|
typename Method |
Generation method. The specific values are as follows:
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 |