Thrill
0.1
|
A class for producing random integers distributed according to the Zipf-Mandelbrot probability mass function:
p(k;N,q,s) = 1/( H(N,q,s)*(k+q)^s )
where H(N,q,s) = sum_(n=1)^(N) 1/(n+q)^s
and s > 1, q >= 0, N > 1.
When q = 0 this becomes the mass function for Zipf's Law When N -> infinity this becomes the Hurwitz Zeta mass function When N -> infinity and q = 0, this becomes the Riemann Zeta mass function
Definition at line 70 of file zipf_distribution.hpp.
#include <zipf_distribution.hpp>
Public Member Functions | |
ZipfDistribution ()=default | |
create uninitialized object. be careful. More... | |
ZipfDistribution (const size_t N, const double s, const double q=0) | |
Creates a new Zipf-Mandelbrot distribution given s, q, N. More... | |
size_t | max () const |
maximum value (inclusive) of distribution More... | |
size_t | min () const |
minimum value of distribution More... | |
size_t | N () const |
deliver population size More... | |
template<typename Engine > | |
size_t | operator() (Engine &eng) |
pick next random number in the range [1,num) More... | |
double | q () const |
parameter of distribution More... | |
double | s () const |
parameter of distribution More... | |
Private Types | |
using | dist_type = std::discrete_distribution< size_t > |
Static Private Member Functions | |
static dist_type | make_dist (size_t N, double s, double q) |
Private Attributes | |
dist_type | dist_ |
size_t | N_ |
double | q_ |
double | s_ |
|
private |
Definition at line 116 of file zipf_distribution.hpp.
|
default |
create uninitialized object. be careful.
|
inline |
Creates a new Zipf-Mandelbrot distribution given s, q, N.
p(k;N,q,s) = 1/( H(N,q,s)*(k+q)^s )
where H(N,q,s) = sum_(n=1)^(N) 1/(n+q)^s
and s > 1, q >= 0, N > 1
Only N and s needs to be specified. The default for q is 0.
Definition at line 88 of file zipf_distribution.hpp.
|
inlinestaticprivate |
Definition at line 119 of file zipf_distribution.hpp.
References LOG1, and ZipfDistribution::N().
|
inline |
maximum value (inclusive) of distribution
Definition at line 109 of file zipf_distribution.hpp.
References ZipfDistribution::N_.
|
inline |
minimum value of distribution
Definition at line 106 of file zipf_distribution.hpp.
|
inline |
deliver population size
Definition at line 97 of file zipf_distribution.hpp.
References ZipfDistribution::N_.
Referenced by ZipfDistribution::make_dist().
|
inline |
pick next random number in the range [1,num)
Definition at line 94 of file zipf_distribution.hpp.
References ZipfDistribution::dist_.
|
inline |
parameter of distribution
Definition at line 100 of file zipf_distribution.hpp.
References ZipfDistribution::q_.
|
inline |
parameter of distribution
Definition at line 103 of file zipf_distribution.hpp.
References ZipfDistribution::s_.
|
private |
Definition at line 117 of file zipf_distribution.hpp.
Referenced by ZipfDistribution::operator()().
|
private |
Definition at line 112 of file zipf_distribution.hpp.
Referenced by ZipfDistribution::max(), and ZipfDistribution::N().
|
private |
Definition at line 114 of file zipf_distribution.hpp.
Referenced by ZipfDistribution::q().
|
private |
Definition at line 113 of file zipf_distribution.hpp.
Referenced by ZipfDistribution::s().