Produces a random integral value from a Zipf distribution.
Declared in <absl/random/distributions.h>
template<
typename IntType,
typename URBG>
IntType
Zipf(
URBG&& urbg,
IntType hi = (std::numeric_limits<IntType>::max)(),
double q = 2.0,
double v = 1.0);
absl::Zipf produces discrete probabilities commonly used for modelling of rare events over the closed interval [0, hi]. The parameters v and q determine the skew of the distribution. T must be an integral type, but may be inferred from the type of hi.
See http://mathworld.wolfram.com/ZipfDistribution.html
Example:
absl::BitGen bitgen; ... int term_rank = absl::Zipf<int>(bitgen);
A random value drawn from the Zipf distribution.
| Name | Description |
|---|---|
| urbg | The uniform random bit generator. |
| hi | The inclusive upper bound of the interval. |
| q | The skew parameter of the distribution. |
| v | The shift parameter of the distribution. |