absl::Exponential

Produces a floating point value from an exponential distribution.

Synopsis

Declared in <absl/random/distributions.h>

template<
    typename RealType,
    typename URBG>
RealType
Exponential(
    URBG&& urbg,
    RealType lambda = 1);

Description

absl::Exponential produces a floating point number representing the distance (time) between two consecutive events in a point process of events occurring continuously and independently at a constant average rate lambda. T must be a floating point type, but may be inferred from the type of lambda.

The mean of the distribution is 1/lambda.

See https://en.wikipedia.org/wiki/Exponential_distribution.

Example:

absl::BitGen bitgen; ... double call_length = absl::Exponential(bitgen, 7.0);

Return Value

A random value drawn from the exponential distribution.

Parameters

NameDescription
urbgThe uniform random bit generator.
lambdaThe constant average rate of events.