Missing javadoc.
This commit is contained in:
parent
79bbb3054c
commit
afe2f3e002
|
@ -260,6 +260,9 @@ public class ZipfDistribution extends AbstractIntegerDistribution {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public int sample() {
|
||||
if (sampler == null) {
|
||||
sampler = new ZipfRejectionInversionSampler(numberOfElements, exponent);
|
||||
|
@ -304,6 +307,10 @@ public class ZipfDistribution extends AbstractIntegerDistribution {
|
|||
/** Constant equal to {@code 2 - hIntegralInverse(hIntegral(2.5) - h(2)}. */
|
||||
private final double s;
|
||||
|
||||
/** Simple constructor.
|
||||
* @param numberOfElements number of elements
|
||||
* @param exponent exponent parameter of the distribution
|
||||
*/
|
||||
ZipfRejectionInversionSampler(final int numberOfElements, final double exponent) {
|
||||
this.exponent = exponent;
|
||||
this.numberOfElements = numberOfElements;
|
||||
|
@ -312,6 +319,10 @@ public class ZipfDistribution extends AbstractIntegerDistribution {
|
|||
this.s = 2d - hIntegralInverse(hIntegral(2.5) - h(2));
|
||||
}
|
||||
|
||||
/** Generate one integral number in the range [1, numberOfElements].
|
||||
* @param random random generator to use
|
||||
* @return generated integral number in the range [1, numberOfElements]
|
||||
*/
|
||||
int sample(final RandomGenerator random) {
|
||||
while(true) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue