You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2018/01/31 22:22:57 UTC

commons-rng git commit: Avoid assignment to method argument.

Repository: commons-rng
Updated Branches:
  refs/heads/master 5f1bb030f -> cb5f147e5


Avoid assignment to method argument.


Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/cb5f147e
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/cb5f147e
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/cb5f147e

Branch: refs/heads/master
Commit: cb5f147e5b8305ad6a154d7063ea83e8702e0a11
Parents: 5f1bb03
Author: Gilles <er...@apache.org>
Authored: Wed Jan 31 23:20:49 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Wed Jan 31 23:20:49 2018 +0100

----------------------------------------------------------------------
 .../distribution/ZigguratNormalizedGaussianSampler.java   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-rng/blob/cb5f147e/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ZigguratNormalizedGaussianSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ZigguratNormalizedGaussianSampler.java b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ZigguratNormalizedGaussianSampler.java
index 7836bb3..3571f3b 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ZigguratNormalizedGaussianSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ZigguratNormalizedGaussianSampler.java
@@ -113,7 +113,7 @@ public class ZigguratNormalizedGaussianSampler
      * Gets the value from the tail of the distribution.
      *
      * @param hz Start random integer.
-     * @param iz Corresponding to hz cell's number.
+     * @param iz Index of cell corresponding to {@code hz}.
      * @return the requested random value.
      */
     private double fix(long hz,
@@ -137,10 +137,10 @@ public class ZigguratNormalizedGaussianSampler
                 if (F[iz] + nextDouble() * (F[iz - 1] - F[iz]) < gauss(x)) {
                     return x;
                 } else {
-                    hz = nextLong();
-                    iz = (int) (hz & LAST);
-                    if (Math.abs(hz) < K[iz]) {
-                        return hz * W[iz];
+                    final long hzNew = nextLong();
+                    final int izNew = (int) (hzNew & LAST);
+                    if (Math.abs(hzNew) < K[izNew]) {
+                        return hzNew * W[izNew];
                     }
                 }
             }