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 2022/05/26 23:02:00 UTC

[commons-rng] branch master updated (f97c0f8d -> ee1e8b9e)

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 f97c0f8d Parameter name typo
     new e6748579 Simplify returns.
     new de466abc Update GH actions versions
     new ec030af6 Ignore IntBuffer in animal sniffer
     new ee1e8b9e Verify the examples in the GH action workflow

The 4 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:
 .github/workflows/coverage.yml                             |  6 +++---
 .github/workflows/maven.yml                                |  9 +++++++--
 commons-rng-examples/examples-stress/pom.xml               |  9 +++++++++
 .../org/apache/commons/rng/sampling/CompositeSamplers.java |  4 ++--
 .../sampling/distribution/ContinuousUniformSampler.java    | 14 ++++----------
 5 files changed, 25 insertions(+), 17 deletions(-)


[commons-rng] 01/04: Simplify returns.

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 e674857954c2f8589392f125fe668f341da16a77
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Thu May 26 21:02:29 2022 +0200

    Simplify returns.
---
 .../org/apache/commons/rng/sampling/CompositeSamplers.java |  4 ++--
 .../sampling/distribution/ContinuousUniformSampler.java    | 14 ++++----------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/CompositeSamplers.java b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/CompositeSamplers.java
index b8941ee0..d46df6b6 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/CompositeSamplers.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/CompositeSamplers.java
@@ -117,7 +117,7 @@ public final class CompositeSamplers {
             public SharedStateDiscreteSampler create(UniformRandomProvider rng, double[] probabilities) {
                 return MarsagliaTsangWangDiscreteSampler.Enumerated.of(rng, probabilities);
             }
-        };
+        }
     }
 
     /**
@@ -262,7 +262,7 @@ public final class CompositeSamplers {
             /** Instance of {@link SharedStateSampler}. */
             SHARED_STATE_SAMPLER,
             /** No specialisation. */
-            NONE;
+            NONE
         }
 
         /**
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ContinuousUniformSampler.java b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ContinuousUniformSampler.java
index 48732b02..02e2013e 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ContinuousUniformSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ContinuousUniformSampler.java
@@ -196,17 +196,11 @@ public class ContinuousUniformSampler
             // (MAX_VALUE has all bits set except the most significant sign bit.)
             bitsx &= Long.MAX_VALUE;
             bitsy &= Long.MAX_VALUE;
-            if (lessThanUnsigned(bitsx + bitsy, MIN_ULP_OPPOSITE_SIGN)) {
-                return false;
-            }
-        } else {
-            // Same signs, subtraction will count the ULP difference.
-            // This should be above 1.
-            if (Math.abs(bitsx - bitsy) < MIN_ULP_SAME_SIGN) {
-                return false;
-            }
+            return !lessThanUnsigned(bitsx + bitsy, MIN_ULP_OPPOSITE_SIGN);
         }
-        return true;
+        // Same signs, subtraction will count the ULP difference.
+        // This should be above 1.
+        return Math.abs(bitsx - bitsy) >= MIN_ULP_SAME_SIGN;
     }
 
     /**


[commons-rng] 03/04: Ignore IntBuffer in animal sniffer

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 ec030af6ae1b81677ccd683e861fd8b93549c466
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Fri May 27 00:00:54 2022 +0100

    Ignore IntBuffer in animal sniffer
    
    JDK9 breaks compatibility with older versions for IntBuffer.flip() by
    returning IntBuffer instead of Buffer.
    
    This ignores this change to allow building on JDK 9+.
---
 commons-rng-examples/examples-stress/pom.xml | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/commons-rng-examples/examples-stress/pom.xml b/commons-rng-examples/examples-stress/pom.xml
index ca8ec784..82bbe772 100644
--- a/commons-rng-examples/examples-stress/pom.xml
+++ b/commons-rng-examples/examples-stress/pom.xml
@@ -76,6 +76,15 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>animal-sniffer-maven-plugin</artifactId>
+        <configuration>
+          <ignores>
+            <ignore>java.nio.IntBuffer</ignore>
+          </ignores>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 


[commons-rng] 02/04: Update GH actions versions

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 de466abc4df3aa5f25b833e199b620317311756e
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Thu May 26 23:22:14 2022 +0100

    Update GH actions versions
---
 .github/workflows/coverage.yml | 6 +++---
 .github/workflows/maven.yml    | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 86ccc5c5..e148b91c 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -29,8 +29,8 @@ jobs:
         java: [ 8 ]
 
     steps:
-    - uses: actions/checkout@v2.4.0
-    - uses: actions/cache@v2.1.7
+    - uses: actions/checkout@v3
+    - uses: actions/cache@v3
       with:
         path: ~/.m2/repository
         key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -45,6 +45,6 @@ jobs:
       run: mvn -V -Pdocs test jacoco:report-aggregate --no-transfer-progress
 
     - name: Upload coverage to Codecov
-      uses: codecov/codecov-action@v2
+      uses: codecov/codecov-action@v3
       with:
         files: ./docs-archive/target/site/jacoco-aggregate/jacoco.xml
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 63d30553..1662e1d7 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -29,8 +29,8 @@ jobs:
         java: [ 8, 11, 17 ]
 
     steps:
-    - uses: actions/checkout@v2.4.0
-    - uses: actions/cache@v2.1.7
+    - uses: actions/checkout@v3
+    - uses: actions/cache@v3
       with:
         path: ~/.m2/repository
         key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}


[commons-rng] 04/04: Verify the examples in the GH action workflow

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 ee1e8b9e80ed34363f7928e5d530dc7726af5f31
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Fri May 27 00:01:37 2022 +0100

    Verify the examples in the GH action workflow
---
 .github/workflows/maven.yml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 1662e1d7..0d04b5b4 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -44,3 +44,8 @@ jobs:
     - name: Build with Maven
       # Use the default goal
       run: mvn -V --no-transfer-progress
+    - name: Build examples with Maven
+      # Examples require Java 11+
+      if: contains(matrix.java, '11')
+      working-directory: ./commons-numbers-examples
+      run: mvn -pl examples-jmh,examples-quadrature,examples-sampling,examples-stress,examples-jpms/jpms-lib,examples-jpms/jpms-app verify apache-rat:check checkstyle:check