Visible to Intel only — GUID: GUID-5C2631D1-2DF9-463B-B3C9-D8D9C349935E
Visible to Intel only — GUID: GUID-5C2631D1-2DF9-463B-B3C9-D8D9C349935E
oneapi::mkl::rng::device::bernoulli
Generates Bernoulli distributed random values.
Description
The oneapi::mkl::rng::device::bernoulli class object is used in the oneapi::mkl::rng::device::generate function to provide Bernoulli distributed random numbers with probability p of a single trial success, where .
A variate is called Bernoulli distributed if after a trial it is equal to 1 with probability of success p and to 0 with probability 1 - p.
The probability distribution is given by:
P(X=1) = p
P(X=0) = 1 - p
The cumulative distribution function is as follows:
API
Syntax
template<typename IntType, typename Method> class bernoulli { public: using method_type = Method; using result_type = IntType; bernoulli(): bernoulli(0.5f){} explicit bernoulli(float p); explicit bernoulli(const param_type& pt); float p() const; param_type param() const; void param(const param_type& pt); };
Include Files
oneapi/mkl/rng/device.hpp
Template Parameters
typename_IntType |
Type of the produced values. The specific values are as follows: std::int32_t std::uint32_t |
typename Method |
Generation method. The specific values are as follows: oneapi::mkl::rng::device::bernoulli_method::icdf See brief descriptions of the methods in Distributions Template Parameter Method. |
Input Parameters
Name |
Type |
Description |
---|---|---|
p |
float |
Success probability p of a trial. |