RandomMixin::rand_exp_duration

Return a duration sampled from an exponential distribution (https://en.wikipedia.org/wiki/Exponential_distribution). Successive events whose intervals are distributed according to this form a memoryless Poisson process. This should be used for repeated network events (e.g. sending a certain type of message) to minimize leaking information to observers.

Synopsis

Declared in <random.h>

std::chrono::microseconds
rand_exp_duration(std::chrono::microseconds mean) noexcept;

Description

The probability of an event occurring before time x is 1 - e^-(x/a) where a is the average interval between events.

Return Value

A duration sampled from an exponential distribution with the given mean.

Parameters

NameDescription
meanThe average interval between events.