onemkl::rng::bernoulli

Generates Bernoulli distributed random values.

Syntax

template<typename T = std::int32_t, method Method = inverse_function>
  class bernoulli {
  public:
    bernoulli(): bernoulli(0.5){}
    bernoulli(double p)
    bernoulli(const bernoulli<T, Method>& other)
    double p() const
    bernoulli<T, Method>& operator=(const  bernoulli<T, Method>& other)
  }

Include Files

  • mkl_sycl.hpp

Description

The onemkl::rng::bernoulli class object is used in the onemkl::rng::generate function to provide Bernoulli distributed random numbers with probability p of a single trial success, where

p∈R; 0 ≤ p ≤ 1.

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:


image0

Input Parameters

Name

Type

Description

method

onemkl::rng::method

Generation method. The specific values are as follows: onemkl::rng::inverse_function See brief descriptions of the methods in Distributions Template Parameter onemkl::rng::method Values.

p

double

Success probability p of a trial.