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 2021/08/09 16:05:31 UTC
[commons-rng] 03/08: Combine conditions
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-rng.git
commit 2300a7ce68bd8fa041dd11b5f2f8084c34bb763a
Author: aherbert <ah...@apache.org>
AuthorDate: Mon Aug 9 13:20:59 2021 +0100
Combine conditions
---
.../apache/commons/rng/sampling/distribution/ZigguratSampler.java | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ZigguratSampler.java b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ZigguratSampler.java
index 9c51cd8..921d2d8 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ZigguratSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ZigguratSampler.java
@@ -798,10 +798,8 @@ public abstract class ZigguratSampler implements SharedStateContinuousSampler {
u1 -= uDiff;
}
x = fastPrngSampleX(X, j, u1);
- if (uDiff > MIN_IE) {
- break;
- }
- if (fastPrngSampleY(Y, j, Long.MIN_VALUE - (u1 + uDiff)) < Math.exp(-0.5 * x * x)) {
+ if (uDiff > MIN_IE ||
+ fastPrngSampleY(Y, j, Long.MIN_VALUE - (u1 + uDiff)) < Math.exp(-0.5 * x * x)) {
break;
}
u1 = randomInt63();