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/09/30 10:40:00 UTC

[commons-rng] branch master updated (9c06264 -> b47c7c3)

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

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


    from 9c06264  Added new XorShiRo generators stress test results.
     new 5ed9a19  RNG-76: Added primitive long constructor to SplitMix64
     new b47c7c3  RNG-76: Track changes.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/commons/rng/core/source64/SplitMix64.java    | 13 ++++++++++++-
 .../apache/commons/rng/core/source64/SplitMix64Test.java    |  7 ++++++-
 src/changes/changes.xml                                     |  3 +++
 3 files changed, 21 insertions(+), 2 deletions(-)


[commons-rng] 01/02: RNG-76: Added primitive long constructor to SplitMix64

Posted by ah...@apache.org.
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

commit 5ed9a195d19758e1291fadd8cca84828f12d1bc6
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Fri Mar 1 21:09:31 2019 +0000

    RNG-76: Added primitive long constructor to SplitMix64
---
 .../org/apache/commons/rng/core/source64/SplitMix64.java    | 13 ++++++++++++-
 .../apache/commons/rng/core/source64/SplitMix64Test.java    |  7 ++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/SplitMix64.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/SplitMix64.java
index 145c874..df243d2 100644
--- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/SplitMix64.java
+++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/SplitMix64.java
@@ -37,7 +37,18 @@ public class SplitMix64 extends LongProvider {
      *
      * @param seed Initial seed.
      */
+    public SplitMix64(long seed) {
+        state = seed;
+    }
+
+    /**
+     * Creates a new instance.
+     *
+     * @param seed Initial seed.
+     */
     public SplitMix64(Long seed) {
+        // Support for Long to allow instantiation through the
+        // rng.simple.RandomSource factory methods.
         setSeedInternal(seed);
     }
 
@@ -47,7 +58,7 @@ public class SplitMix64 extends LongProvider {
      * @param seed Seed.
      */
     private void setSeedInternal(Long seed) {
-        state = seed;
+        state = seed.longValue();
     }
 
     /** {@inheritDoc} */
diff --git a/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/SplitMix64Test.java b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/SplitMix64Test.java
index affa81f..5ec141c 100644
--- a/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/SplitMix64Test.java
+++ b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/SplitMix64Test.java
@@ -35,6 +35,11 @@ public class SplitMix64Test {
             0x24b5d9d7a00a3140L, 0x79d983d781a34a3cL, 0x582e4a84d595f5ecL, 0x7316fe8b0f606d20L,
         };
 
-        RandomAssert.assertEquals(expectedSequence, new SplitMix64(0x1a2b3c4d5e6f7531L));
+        final long seed = 0x1a2b3c4d5e6f7531L;
+
+        RandomAssert.assertEquals(expectedSequence, new SplitMix64(seed));
+
+        // Test with Long
+        RandomAssert.assertEquals(expectedSequence, new SplitMix64(Long.valueOf(seed)));
     }
 }


[commons-rng] 02/02: RNG-76: Track changes.

Posted by ah...@apache.org.
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

commit b47c7c3164858e84485aa15d649039d5102bf130
Author: aherbert <ah...@apache.org>
AuthorDate: Mon Sep 30 11:39:55 2019 +0100

    RNG-76: Track changes.
---
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index abd27eb..d75ec75 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -75,6 +75,9 @@ re-run tests that fail, and pass the build if they succeed
 within the allotted number of reruns (the test will be marked
 as 'flaky' in the report).
 ">
+      <action dev="aherbert" type="update" issue="RNG-76">
+        "SplitMix64": Added primitive long constructor.
+      </action>
       <action dev="aherbert" type="add" issue="RNG-117">
         Additional "XorShiRo" family generators. This adds 4 PlusPlus general purpose variants
         of existing generators and 3 variants of a large state (1024-bit) generator.