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/19 21:10:47 UTC

[commons-rng] branch master updated (dfb25fd -> 913286e)

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 dfb25fd  Removed reverse bytes from stress test code.
     add 647326a  RNG-81: NumberFactory to sample all rationals between 0 and 1.
     new 8e4fef6  Merge branch 'improvement-RNG-81'
     new 0f403be  Track changes.
     add 445ddfe  RNG-78: Added a ThreadLocalRandomSource.
     add 1877cf2  RNG-78: Update test to wait for thread to end then assert.
     add 464844e  RNG-78: Add direct use of ThreadLocal<RNG> to benchmark.
     add 8cac0a1  RNG-78: Change protected field to private.
     add 7f0a9ad  RNG-78: Add more values to the benchmark.
     new 523ceb7  Merge branch 'feature-RNG-78'
     new 338dc44  RNG-78: Track changes.
     new 913286e  Auto generate the stress test GeneratorsList from the RandomSource enum

The 5 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:
 .../commons/rng/core/util/NumberFactory.java       |  33 ++--
 .../commons/rng/core/util/NumberFactoryTest.java   |  38 +++-
 .../rng/examples/jmh/ThreadLocalPerformance.java   | 207 +++++++++++++++++++++
 .../rng/examples/stress/GeneratorsList.java        |  53 ++++--
 .../rng/simple/ThreadLocalRandomSource.java        | 135 ++++++++++++++
 .../rng/simple/ThreadLocalRandomSourceTest.java    | 115 ++++++++++++
 src/changes/changes.xml                            |   6 +
 7 files changed, 552 insertions(+), 35 deletions(-)
 create mode 100644 commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/ThreadLocalPerformance.java
 create mode 100644 commons-rng-simple/src/main/java/org/apache/commons/rng/simple/ThreadLocalRandomSource.java
 create mode 100644 commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ThreadLocalRandomSourceTest.java


[commons-rng] 01/05: Merge branch 'improvement-RNG-81'

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 8e4fef6a1246cf4c6c2c59b69245187eaec028f4
Merge: dfb25fd 647326a
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Tue Mar 19 20:16:08 2019 +0000

    Merge branch 'improvement-RNG-81'

 .../commons/rng/core/util/NumberFactory.java       | 33 ++++++++++++-------
 .../commons/rng/core/util/NumberFactoryTest.java   | 38 ++++++++++++++++++----
 2 files changed, 54 insertions(+), 17 deletions(-)


[commons-rng] 05/05: Auto generate the stress test GeneratorsList from the RandomSource enum

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 913286e1e83b38b66bcff2f3856583e67b072251
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Tue Mar 19 21:10:43 2019 +0000

    Auto generate the stress test GeneratorsList from the RandomSource enum
---
 .../rng/examples/stress/GeneratorsList.java        | 53 ++++++++++++++--------
 1 file changed, 35 insertions(+), 18 deletions(-)

diff --git a/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/GeneratorsList.java b/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/GeneratorsList.java
index 037f60b..d0bdabe 100644
--- a/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/GeneratorsList.java
+++ b/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/GeneratorsList.java
@@ -18,6 +18,7 @@ package org.apache.commons.rng.examples.stress;
 
 import java.util.List;
 import java.util.ArrayList;
+import java.util.EnumSet;
 import java.util.Iterator;
 
 import org.apache.commons.rng.UniformRandomProvider;
@@ -27,28 +28,44 @@ import org.apache.commons.rng.simple.RandomSource;
  * List of generators.
  */
 public class GeneratorsList implements Iterable<UniformRandomProvider> {
-    /** List. */
-    private final List<UniformRandomProvider> list = new ArrayList<UniformRandomProvider>();
+    /**
+     * The RandomSource values to ignore when auto generating the list
+     * from the enumeration.
+     */
+    private static final EnumSet<RandomSource> toIgnore =
+            EnumSet.of(RandomSource.TWO_CMRES_SELECT);
+
+    /** List of generators. */
+    private final List<UniformRandomProvider> list = new ArrayList<>();
 
     /**
-     * Creates list.
+     * Creates the list.
      */
     public GeneratorsList() {
-        list.add(RandomSource.create(RandomSource.JDK));
-        list.add(RandomSource.create(RandomSource.MT));
-        list.add(RandomSource.create(RandomSource.WELL_512_A));
-        list.add(RandomSource.create(RandomSource.WELL_1024_A));
-        list.add(RandomSource.create(RandomSource.WELL_19937_A));
-        list.add(RandomSource.create(RandomSource.WELL_19937_C));
-        list.add(RandomSource.create(RandomSource.WELL_44497_A));
-        list.add(RandomSource.create(RandomSource.WELL_44497_B));
-        list.add(RandomSource.create(RandomSource.ISAAC));
-        list.add(RandomSource.create(RandomSource.MT_64));
-        list.add(RandomSource.create(RandomSource.SPLIT_MIX_64));
-        list.add(RandomSource.create(RandomSource.XOR_SHIFT_1024_S));
-        list.add(RandomSource.create(RandomSource.TWO_CMRES));
-        list.add(RandomSource.create(RandomSource.MWC_256));
-        list.add(RandomSource.create(RandomSource.KISS));
+        // Auto-generate using the order of the RandomSource enum
+        for (final RandomSource source : RandomSource.values()) {
+            // Ignore those generators known to take arguments
+            if (toIgnore.contains(source)) {
+                continue;
+            }
+            // Currently we cannot detect if the source requires arguments,
+            // e.g. RandomSource.TWO_CMRES_SELECT. So try and create
+            // using no arguments and allow this to throw
+            // IllegalStateException if it cannot be created.
+            //
+            // Implementation note:
+            // Handle such generators by adding to the ignore set and
+            // if they must be included add as a special case below.
+            list.add(RandomSource.create(source));
+        }
+
+        // --------------------------------------------------------------------
+        // Note:
+        // Add any special cases that cannot be created without arguments here.
+        // --------------------------------------------------------------------
+        // The list must then be sorted using the order defined by
+        // RandomSource.ordinal(). Currently this is not required so
+        // has not been implemented.
     }
 
     /** {@inheritDoc} */


[commons-rng] 03/05: Merge branch 'feature-RNG-78'

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 523ceb7630ca21861bf0a5209549c7163574bf6e
Merge: 0f403be 7f0a9ad
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Tue Mar 19 20:20:32 2019 +0000

    Merge branch 'feature-RNG-78'

 .../rng/examples/jmh/ThreadLocalPerformance.java   | 207 +++++++++++++++++++++
 .../rng/simple/ThreadLocalRandomSource.java        | 135 ++++++++++++++
 .../rng/simple/ThreadLocalRandomSourceTest.java    | 115 ++++++++++++
 3 files changed, 457 insertions(+)


[commons-rng] 02/05: 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 0f403be44293644b26f0662c72c5573dd6f7c303
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Tue Mar 19 20:18:56 2019 +0000

    Track changes.
    
    Closes #29
---
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 0e2d57f..45ee0b7 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-81">
+        "NumberFactory": Evenly sample all dyadic rationals between 0 and 1.
+      </action>
       <action dev="aherbert" type="add" issue="RNG-79">
         Benchmark methods for producing nextDouble and nextFloat.
       </action>


[commons-rng] 04/05: RNG-78: 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 338dc4426b5b2964079eb7e98b52745c1757ecf7
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Tue Mar 19 20:23:33 2019 +0000

    RNG-78: Track changes.
    
    Closes #27
---
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 45ee0b7..398de55 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="add" issue="RNG-78">
+        New "ThreadLocalRandomSource" class provides thread safe access to random generators.
+      </action>
       <action dev="aherbert" type="update" issue="RNG-81">
         "NumberFactory": Evenly sample all dyadic rationals between 0 and 1.
       </action>