public class RejectionInversionZipfSampler extends SamplerBase implements DiscreteSampler
Constructor and Description |
---|
RejectionInversionZipfSampler(UniformRandomProvider rng,
int numberOfElements,
double exponent) |
Modifier and Type | Method and Description |
---|---|
int |
sample()
Rejection inversion sampling method for a discrete, bounded Zipf
distribution that is based on the method described in
Wolfgang Hörmann and Gerhard Derflinger.
|
String |
toString() |
nextDouble, nextInt, nextInt
public RejectionInversionZipfSampler(UniformRandomProvider rng, int numberOfElements, double exponent)
rng
- Generator of uniformly distributed random numbers.numberOfElements
- Number of elements.exponent
- Exponent.IllegalArgumentException
- if numberOfElements <= 0
or exponent <= 0
.public int sample()
Wolfgang Hörmann and Gerhard Derflinger. "Rejection-inversion to generate variates from monotone discrete distributions",
ACM Transactions on Modeling and Computer Simulation (TOMACS) 6.3 (1996): 169-184.
sample
in interface DiscreteSampler
public String toString()
toString
in class SamplerBase
Copyright © 2016 The Apache Software Foundation. All rights reserved.