geometric
Generates geometrically distributed random values.
Description
The geometric class object is used in the generate function to provide geometrically distributed random numbers with probability p of a single trial success, where \(p \in R; 0 \leq p \leq 1\).
The probability distribution is given by:
\[P(X = k) = p * (1 - p)^k, k = \{0, 1, 2, ... \}.\]
The cumulative distribution function is as follows:
\[\begin{split}F_p(x) = \begin{cases} 0, x < 0 \\ 1 - (1 - p)^{\lfloor x + 1 \rfloor}, x \ge 0 \end{cases}\end{split}\]
API
Syntax
namespace oneapi::mkl::rng::device {
template<typename IntType, typename Method>
class geometric {
public:
using method_type = Method;
using result_type = IntType;
geometric(): geometric(0.5f){}
explicit geometric(float p);
explicit geometric(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 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 |
|---|---|---|
p |
float |
Success probability p of a trial. |