commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r1152659 - /commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomAdaptorTest.java
Date Sun, 31 Jul 2011 22:51:36 GMT
Author: psteitz
Date: Sun Jul 31 22:51:35 2011
New Revision: 1152659

URL: http://svn.apache.org/viewvc?rev=1152659&view=rev
Log:
Made ConstantGenerator public and constant value configurable.

Modified:
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomAdaptorTest.java

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomAdaptorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomAdaptorTest.java?rev=1152659&r1=1152658&r2=1152659&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomAdaptorTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/RandomAdaptorTest.java
Sun Jul 31 22:51:35 2011
@@ -58,7 +58,17 @@ public class RandomAdaptorTest {
      * "Powered by Eclipse ;-)"
      *
      */
-    private static class ConstantGenerator implements RandomGenerator {
+    public static class ConstantGenerator implements RandomGenerator {
+        
+        private final double value;
+        
+        public ConstantGenerator() {
+            value = 0;
+        }
+        
+        public ConstantGenerator(double value) {
+            this.value = value;
+        }
 
         public boolean nextBoolean() {
             return false;
@@ -68,27 +78,27 @@ public class RandomAdaptorTest {
         }
 
         public double nextDouble() {
-            return 0;
+            return value;
         }
 
         public float nextFloat() {
-            return 0;
+            return (float) value;
         }
 
         public double nextGaussian() {
-            return 0;
+            return value;
         }
 
         public int nextInt() {
-            return 0;
+            return (int) value;
         }
 
         public int nextInt(int n) {
-            return 0;
+            return (int) value;
         }
 
         public long nextLong() {
-            return 0;
+            return (int) value;
         }
 
         public void setSeed(int seed) {



Mime
View raw message