You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2019/03/25 15:15:25 UTC

[commons-rng] branch master updated: XorShift1024Star: Reorder arguments in protected constructor.

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git


The following commit(s) were added to refs/heads/master by this push:
     new ac99f01  XorShift1024Star: Reorder arguments in protected constructor.
ac99f01 is described below

commit ac99f017f22b76153a4553134b9bc046bb306557
Author: aherbert <ah...@apache.org>
AuthorDate: Mon Mar 25 15:15:20 2019 +0000

    XorShift1024Star: Reorder arguments in protected constructor.
---
 .../org/apache/commons/rng/core/source64/XorShift1024Star.java    | 8 ++++----
 .../org/apache/commons/rng/core/source64/XorShift1024StarPhi.java | 2 +-
 .../apache/commons/rng/core/source64/XorShift1024StarPhiTest.java | 2 --
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/XorShift1024Star.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/XorShift1024Star.java
index 2a871e6..5858052 100644
--- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/XorShift1024Star.java
+++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/XorShift1024Star.java
@@ -49,21 +49,21 @@ public class XorShift1024Star extends LongProvider {
      * set. A seed containing all zeros will create a non-functional generator.
      */
     public XorShift1024Star(long[] seed) {
-        this(1181783497276652981L, seed);
+        this(seed, 1181783497276652981L);
     }
 
     /**
      * Creates a new instance.
      *
-     * @param multiplier The multiplier for the XorShift1024 algorithm.
      * @param seed Initial seed.
      * If the length is larger than 16, only the first 16 elements will
      * be used; if smaller, the remaining elements will be automatically
      * set. A seed containing all zeros will create a non-functional generator.
+     * @param multiplier The multiplier for the XorShift1024 algorithm.
      */
-    protected XorShift1024Star(long multiplier, long[] seed) {
-        this.multiplier = multiplier;
+    protected XorShift1024Star(long[] seed, long multiplier) {
         setSeedInternal(seed);
+        this.multiplier = multiplier;
     }
 
     /** {@inheritDoc} */
diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/XorShift1024StarPhi.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/XorShift1024StarPhi.java
index b8d60f8..a51d462 100644
--- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/XorShift1024StarPhi.java
+++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/XorShift1024StarPhi.java
@@ -41,6 +41,6 @@ public class XorShift1024StarPhi extends XorShift1024Star {
      * set. A seed containing all zeros will create a non-functional generator.
      */
     public XorShift1024StarPhi(long[] seed) {
-        super(0x9e3779b97f4a7c13L, seed);
+        super(seed, 0x9e3779b97f4a7c13L);
     }
 }
diff --git a/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/XorShift1024StarPhiTest.java b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/XorShift1024StarPhiTest.java
index ffde7a4..b88286d 100644
--- a/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/XorShift1024StarPhiTest.java
+++ b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/XorShift1024StarPhiTest.java
@@ -16,8 +16,6 @@
  */
 package org.apache.commons.rng.core.source64;
 
-import org.apache.commons.math3.stat.correlation.PearsonsCorrelation;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
 import org.apache.commons.rng.core.RandomAssert;
 import org.junit.Assert;
 import org.junit.Test;