absl::zipf_distribution

A distribution over random integer-values in the range [0, k].

Synopsis

Declared in <absl/random/zipf_distribution.h>

template<typename IntType = int>
class zipf_distribution;

Description

absl::zipf_distribution produces random integer-values in the range [0, k], distributed according to the unnormalized discrete probability function:

P(x) = (v + x) ^ -q

The parameter v must be greater than 0 and the parameter q must be greater than 1. If either of these parameters take invalid values then the behavior is undefined.

IntType is the result_type generated by the generator. It must be of integral type; a static_assert ensures this is the case.

The implementation is based on W.Hormann, G.Derflinger:

"Rejection-Inversion to Generate Variates from Monotone Discrete Distributions"

http://eeyore.wu-wien.ac.at/papers/96-04-04.wh-der.ps.gz

Types

NameDescription
param_type The parameter set of the distribution.

Type Aliases

NameDescription
result_type The type of the values produced by the distribution.

Member Functions

NameDescription
zipf_distribution [constructor]Constructors
k Returns the largest value the distribution can produce.
max Returns the largest value the distribution can produce.
min Returns the smallest value the distribution can produce.
operator() Function call operators
param param overloads
q Returns the exponent parameter of the distribution.
reset Resets the internal state of the distribution.
v Returns the offset parameter of the distribution.

Friends

NameDescription
absl::operator!=Compares two distributions for inequality.
absl::operator==Compares two distributions for equality.