Missing javadoc. Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/afe2f3e0 Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/afe2f3e0 Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/afe2f3e0
Branch: refs/heads/MATH_3_X Commit: afe2f3e00222957b14e548d5ae27ed4b6d67f526 Parents: 79bbb30 Author: Luc Maisonobe <l...@apache.org> Authored: Mon Aug 31 13:55:31 2015 +0200 Committer: Luc Maisonobe <l...@apache.org> Committed: Mon Aug 31 13:58:24 2015 +0200 ---------------------------------------------------------------------- .../commons/math3/distribution/ZipfDistribution.java | 11 +++++++++++ 1 file changed, 11 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-math/blob/afe2f3e0/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java b/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java index bd43d35..cca312a 100644 --- a/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java +++ b/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java @@ -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) {