commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [5/6] commons-rng git commit: Redundant local variable.
Date Tue, 22 Nov 2016 13:07:06 GMT
Redundant local variable.


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

Branch: refs/heads/master
Commit: 37f5ecbe4c8e2da236749d1c86bcf9adc5be995b
Parents: 029b91c
Author: Gilles <erans@apache.org>
Authored: Tue Nov 22 13:47:02 2016 +0100
Committer: Gilles <erans@apache.org>
Committed: Tue Nov 22 13:47:02 2016 +0100

----------------------------------------------------------------------
 .../apache/commons/rng/sampling/distribution/PoissonSampler.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-rng/blob/37f5ecbe/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
index 7d7d896..8abaa68 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
@@ -90,11 +90,9 @@ public class PoissonSampler
             double p = Math.exp(-meanPoisson);
             long n = 0;
             double r = 1;
-            double rnd = 1;
 
             while (n < 1000 * meanPoisson) {
-                rnd = nextDouble();
-                r *= rnd;
+                r *= nextDouble();
                 if (r >= p) {
                     n++;
                 } else {


Mime
View raw message