You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2016/01/17 11:42:05 UTC

[16/22] [math] Reverting commit e0d17fed51f5018fc34578699d824c20efc44368 as per Gilles request.

Reverting commit e0d17fed51f5018fc34578699d824c20efc44368 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp branch.


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

Branch: refs/heads/master
Commit: 794dda1fbb2d54dd54934e88d9867ada0c7ac54d
Parents: a4456b8
Author: Luc Maisonobe <lu...@apache.org>
Authored: Sun Jan 17 11:35:25 2016 +0100
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

----------------------------------------------------------------------
 .../commons/math4/random/ISAACRandom.java       | 41 ++++----------------
 1 file changed, 7 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/794dda1f/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/ISAACRandom.java b/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
index 185710f..b9c0e36 100644
--- a/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
+++ b/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
@@ -85,7 +85,7 @@ public class ISAACRandom
      * current time and system hash code of the instance as the seed.
      */
     public ISAACRandom() {
-        setSeedInternal(System.currentTimeMillis() + System.identityHashCode(this));
+        setSeed(System.currentTimeMillis() + System.identityHashCode(this));
     }
 
     /**
@@ -94,7 +94,7 @@ public class ISAACRandom
      * @param seed Initial seed.
      */
     public ISAACRandom(long seed) {
-        setSeedInternal(seed);
+        setSeed(seed);
     }
 
     /**
@@ -104,51 +104,24 @@ public class ISAACRandom
      * to the current time.
      */
     public ISAACRandom(int[] seed) {
-        setSeedInternal(seed);
+        setSeed(seed);
     }
 
     /** {@inheritDoc} */
     @Override
     public void setSeed(int seed) {
-        setSeedInternal(seed);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setSeed(int[] seed) {
-        setSeedInternal(seed);
+        setSeed(new int[]{seed});
     }
 
     /** {@inheritDoc} */
     @Override
     public void setSeed(long seed) {
-        setSeedInternal(seed);
-    }
-
-    /**
-     * Reseeds the RNG.
-     *
-     * @param seed Seed.
-     */
-    private void setSeedInternal(int seed) {
-        setSeed(new int[]{seed});
-    }
-
-    /**
-     * Reseeds the RNG.
-     *
-     * @param seed Seed.
-     */
-    private void setSeedInternal(long seed) {
         setSeed(new int[]{(int) (seed >>> 32), (int) (seed & 0xffffffffL)});
     }
 
-    /**
-     * Reseeds the RNG.
-     *
-     * @param seed Seed.
-     */
-    private void setSeedInternal(int[] seed) {
+    /** {@inheritDoc} */
+    @Override
+    public void setSeed(int[] seed) {
         if (seed == null) {
             setSeed(System.currentTimeMillis() + System.identityHashCode(this));
             return;