geometric#
Generates geometrically distributed random values.
Description
The geometric
class object is used in the generate
and 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:
The cumulative distribution function is as follows:
class geometric#
Syntax
namespace oneapi::math::rng::device {
template<typename IntType, typename Method>
class geometric {
public:
using method_type = Method;
using result_type = IntType;
geometric();
explicit geometric(float p);
float p() const;
};
}
Template parameters
- typename IntType
- Type of the produced values. Supported types:
std::int32_t
std::uint32_t
std::int64_t
std::uint64_t
- typename Method = oneapi::math::rng::geometric_method::by_default
Transformation method, which will be used for generation. Supported types:
oneapi::math::rng::geometric_method::by_default
oneapi::math::rng::geometric_method::icdf
See description of the methods in Distributions methods template parameter.
Class Members
Routine |
Description |
---|---|
Default constructor |
|
Constructor with parameters |
|
Method to obtain probability p |
Member types
geometric::method_type = Method
Description
The type which defines transformation method for generation.
geometric::result_type = IntType
Description
The type which defines type of generated random numbers.
Constructors
geometric::geometric()
Description
Default constructor for distribution, parameters set as p = 0.5f.
explicit geometric::geometric(float p)
Description
Constructor with parameters. p is a probability value.
Throws
- oneapi::math::invalid_argument
Exception is thrown when \(p \ge 1.0f\), or \(p \leq 0.0f\)
Characteristics
float geometric::p() const
Return Value
Returns the distribution parameter p - probability value.
Parent topic: Device Distributions