You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2022/11/30 14:14:22 UTC
[commons-statistics] branch master updated: Add comment that RNG 1.6 will not be affected by the change
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-statistics.git
The following commit(s) were added to refs/heads/master by this push:
new 3d2cc5e Add comment that RNG 1.6 will not be affected by the change
3d2cc5e is described below
commit 3d2cc5e959641b4de3725134d36163e927a1e15b
Author: aherbert <ah...@apache.org>
AuthorDate: Wed Nov 30 14:13:58 2022 +0000
Add comment that RNG 1.6 will not be affected by the change
---
.../org/apache/commons/statistics/distribution/ParetoDistribution.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ParetoDistribution.java b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ParetoDistribution.java
index 41877c1..ce4415b 100644
--- a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ParetoDistribution.java
+++ b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ParetoDistribution.java
@@ -296,12 +296,13 @@ public final class ParetoDistribution extends AbstractContinuousDistribution {
@Override
public ContinuousDistribution.Sampler createSampler(final UniformRandomProvider rng) {
// Pareto distribution sampler.
- // Commons RNG v1.5 uses nextDouble() for (1 - p) effectively sampling from p in (0, 1].
+ // Commons RNG v1.5 uses nextDouble for (1 - p) effectively sampling from p in (0, 1].
// Ensure sampling is concentrated at the lower / upper bound at extreme shapes:
// Large shape should sample using p in [0, 1) (lower bound)
// Small shape should sample using p in (0, 1] (upper bound)
// Note: For small shape the input RNG is also wrapped to use nextLong as the source of
// randomness; this ensures the nextDouble method uses the interface output of [0, 1).
+ // Commons RNG v1.6 uses nextLong and will not be affected changes to nextDouble.
final UniformRandomProvider wrappedRng = shape >= 1 ? new InvertedRNG(rng) : rng::nextLong;
return InverseTransformParetoSampler.of(wrappedRng, scale, shape)::sample;
}