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/138f84bf Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/138f84bf Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/138f84bf
Branch: refs/heads/master Commit: 138f84bfa5d36c8f6e2825640af1ed82daa9dc1d Parents: 672b6c6 Author: Luc Maisonobe <l...@apache.org> Authored: Mon Aug 31 13:49:54 2015 +0200 Committer: Luc Maisonobe <l...@apache.org> Committed: Mon Aug 31 13:49:54 2015 +0200 ---------------------------------------------------------------------- .../apache/commons/math4/distribution/ZipfDistribution.java | 8 ++++++++ 1 file changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-math/blob/138f84bf/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java b/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java index e44b4b5..7fd62e1 100644 --- a/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java @@ -316,6 +316,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; @@ -324,6 +328,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) {