commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [5/7] commons-rng git commit: Method renamed.
Date Tue, 15 Nov 2016 16:29:18 GMT
Method renamed.


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

Branch: refs/heads/RNG-30__sampling
Commit: d3a7be3ae38235afd34fcc9cdb5e06fb933be82a
Parents: d2e6b6e
Author: Gilles <erans@apache.org>
Authored: Tue Nov 15 17:00:07 2016 +0100
Committer: Gilles <erans@apache.org>
Committed: Tue Nov 15 17:00:07 2016 +0100

----------------------------------------------------------------------
 .../distribution/AhrensDieterExponentialSampler.java         | 6 +++---
 .../distribution/AhrensDieterMarsagliaTsangGammaSampler.java | 8 ++++----
 .../rng/sampling/distribution/BoxMullerGaussianSampler.java  | 4 ++--
 .../commons/rng/sampling/distribution/ChengBetaSampler.java  | 8 ++++----
 .../rng/sampling/distribution/ContinuousUniformSampler.java  | 2 +-
 .../distribution/InverseTransformContinuousSampler.java      | 2 +-
 .../distribution/InverseTransformDiscreteSampler.java        | 2 +-
 .../sampling/distribution/InverseTransformParetoSampler.java | 2 +-
 .../commons/rng/sampling/distribution/PoissonSampler.java    | 4 ++--
 .../sampling/distribution/RejectionInversionZipfSampler.java | 2 +-
 .../commons/rng/sampling/distribution/SamplerBase.java       | 2 +-
 11 files changed, 21 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-rng/blob/d3a7be3a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterExponentialSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterExponentialSampler.java
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterExponentialSampler.java
index e43dee2..41682ea 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterExponentialSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterExponentialSampler.java
@@ -74,7 +74,7 @@ public class AhrensDieterExponentialSampler
     public double sample() {
         // Step 1:
         double a = 0;
-        double u = nextUniform();
+        double u = nextDouble();
 
         // Step 2 and 3:
         while (u < 0.5) {
@@ -92,13 +92,13 @@ public class AhrensDieterExponentialSampler
 
         // Step 6:
         int i = 0; // Should be 1, be we iterate before it in while using 0.
-        double u2 = nextUniform();
+        double u2 = nextDouble();
         double umin = u2;
 
         // Step 7 and 8:
         do {
             ++i;
-            u2 = nextUniform();
+            u2 = nextDouble();
 
             if (u2 < umin) {
                 umin = u2;

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/d3a7be3a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterMarsagliaTsangGammaSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterMarsagliaTsangGammaSampler.java
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterMarsagliaTsangGammaSampler.java
index 526b94a..90fefc7 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterMarsagliaTsangGammaSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterMarsagliaTsangGammaSampler.java
@@ -73,7 +73,7 @@ public class AhrensDieterMarsagliaTsangGammaSampler
 
             while (true) {
                 // Step 1:
-                final double u = nextUniform();
+                final double u = nextDouble();
                 final double bGS = 1 + theta / Math.E;
                 final double p = bGS * u;
 
@@ -81,7 +81,7 @@ public class AhrensDieterMarsagliaTsangGammaSampler
                     // Step 2:
 
                     final double x = Math.pow(p, 1 / theta);
-                    final double u2 = nextUniform();
+                    final double u2 = nextDouble();
 
                     if (u2 > Math.exp(-x)) {
                         // Reject.
@@ -93,7 +93,7 @@ public class AhrensDieterMarsagliaTsangGammaSampler
                     // Step 3:
 
                     final double x = -1 * Math.log((bGS - p) / theta);
-                    final double u2 = nextUniform();
+                    final double u2 = nextDouble();
 
                     if (u2 > Math.pow(x, theta - 1)) {
                         // Reject.
@@ -119,7 +119,7 @@ public class AhrensDieterMarsagliaTsangGammaSampler
             }
 
             final double x2 = x * x;
-            final double u = nextUniform();
+            final double u = nextDouble();
 
             // Squeeze.
             if (u < 1 - 0.0331 * x2 * x2) {

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/d3a7be3a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerGaussianSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerGaussianSampler.java
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerGaussianSampler.java
index 65cbd5a..527db1e 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerGaussianSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerGaussianSampler.java
@@ -52,8 +52,8 @@ public class BoxMullerGaussianSampler
         if (Double.isNaN(nextGaussian)) {
             // Generate a pair of Gaussian numbers.
 
-            final double x = nextUniform();
-            final double y = nextUniform();
+            final double x = nextDouble();
+            final double y = nextDouble();
             final double alpha = 2 * Math.PI * x;
             final double r = Math.sqrt(-2 * Math.log(y));
 

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/d3a7be3a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ChengBetaSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ChengBetaSampler.java
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ChengBetaSampler.java
index 827752c..5335947 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ChengBetaSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ChengBetaSampler.java
@@ -91,8 +91,8 @@ public class ChengBetaSampler
         double w;
         double t;
         do {
-            final double u1 = nextUniform();
-            final double u2 = nextUniform();
+            final double u1 = nextDouble();
+            final double u2 = nextDouble();
             final double v = beta * (Math.log(u1) - Math.log1p(-u1));
             w = a * Math.exp(v);
             final double z = u1 * u1 * u2;
@@ -131,8 +131,8 @@ public class ChengBetaSampler
 
         double w;
         while (true) {
-            final double u1 = nextUniform();
-            final double u2 = nextUniform();
+            final double u1 = nextDouble();
+            final double u2 = nextDouble();
             final double y = u1 * u2;
             final double z = u1 * y;
             if (u1 < 0.5) {

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/d3a7be3a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ContinuousUniformSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ContinuousUniformSampler.java
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ContinuousUniformSampler.java
index a2287f7..86d0ea4 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ContinuousUniformSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ContinuousUniformSampler.java
@@ -45,7 +45,7 @@ public class ContinuousUniformSampler
     /** {@inheritDoc} */
     @Override
     public double sample() {
-        final double u = nextUniform();
+        final double u = nextDouble();
         return u * hi + (1 - u) * lo;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/d3a7be3a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformContinuousSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformContinuousSampler.java
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformContinuousSampler.java
index 1d057bb..d79665b 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformContinuousSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformContinuousSampler.java
@@ -73,7 +73,7 @@ public class InverseTransformContinuousSampler
     /** {@inheritDoc} */
     @Override
     public double sample() {
-        return function.inverseCumulativeProbability(nextUniform());
+        return function.inverseCumulativeProbability(nextDouble());
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/d3a7be3a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformDiscreteSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformDiscreteSampler.java
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformDiscreteSampler.java
index 2dc0a20..ed0cfd9 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformDiscreteSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformDiscreteSampler.java
@@ -73,7 +73,7 @@ public class InverseTransformDiscreteSampler
     /** {@inheritDoc} */
     @Override
     public int sample() {
-        return function.inverseCumulativeProbability(nextUniform());
+        return function.inverseCumulativeProbability(nextDouble());
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/d3a7be3a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformParetoSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformParetoSampler.java
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformParetoSampler.java
index 4c4ae39..27c543f 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformParetoSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InverseTransformParetoSampler.java
@@ -45,7 +45,7 @@ public class InverseTransformParetoSampler
     /** {@inheritDoc} */
     @Override
     public double sample() {
-        return scale / Math.pow(nextUniform(), 1 / shape);
+        return scale / Math.pow(nextDouble(), 1 / shape);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/d3a7be3a/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 bf998a0..605678e 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
@@ -86,7 +86,7 @@ public class PoissonSampler
             double rnd = 1;
 
             while (n < 1000 * meanPoisson) {
-                rnd = nextUniform();
+                rnd = nextDouble();
                 r *= rnd;
                 if (r >= p) {
                     n++;
@@ -119,7 +119,7 @@ public class PoissonSampler
             double qr = 0;
             double qa = 0;
             while (true) {
-                final double u = nextUniform();
+                final double u = nextDouble();
                 if (u <= p1) {
                     final double n = gaussian.sample();
                     x = n * Math.sqrt(lambda + halfDelta) - 0.5d;

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/d3a7be3a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/RejectionInversionZipfSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/RejectionInversionZipfSampler.java
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/RejectionInversionZipfSampler.java
index c939028..02b1ca4 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/RejectionInversionZipfSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/RejectionInversionZipfSampler.java
@@ -97,7 +97,7 @@ public class RejectionInversionZipfSampler
     @Override
     public int sample() {
         while(true) {
-            final double u = hIntegralNumberOfElements + nextUniform() * (hIntegralX1 - hIntegralNumberOfElements);
+            final double u = hIntegralNumberOfElements + nextDouble() * (hIntegralX1 - hIntegralNumberOfElements);
             // u is uniformly distributed in (hIntegralX1, hIntegralNumberOfElements]
 
             double x = hIntegralInverse(u);

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/d3a7be3a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/SamplerBase.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/SamplerBase.java
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/SamplerBase.java
index 3737a48..d345146 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/SamplerBase.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/SamplerBase.java
@@ -36,7 +36,7 @@ public class SamplerBase {
      * @return a random value from a uniform distribution in the
      * interval {@code [0, 1)}.
      */
-    protected double nextUniform() {
+    protected double nextDouble() {
         return rng.nextDouble();
     }
 


Mime
View raw message