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 38c0bc6  Ensure full test coverage of MultiplyWithCarry256.
38c0bc6 is described below

commit 38c0bc6ac77181d6a7f106bdfd99be7a5bf63e35
Author: aherbert <aherb...@apache.org>
AuthorDate: Fri Feb 15 10:40:48 2019 +0000

    Ensure full test coverage of MultiplyWithCarry256.
    
    This removes the randomness from test coverage due to using random
    seeds. Sometimes the conditional to set the carry using the absolute of
    the first seed value was never hit.
---
 .../java/org/apache/commons/rng/core/source32/MultiplyWithCarry256.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/MultiplyWithCarry256.java
 
b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/MultiplyWithCarry256.java
index 9de791e..bcd60e9 100644
--- 
a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/MultiplyWithCarry256.java
+++ 
b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/MultiplyWithCarry256.java
@@ -97,7 +97,7 @@ public class MultiplyWithCarry256 extends IntProvider {
         // First element of the "seed" is the initial "carry".
         final int c = tmp[0];
         // Marsaglia's recommendation: 0 <= carry < A.
-        carry = (int) ((c < 0 ? -c : c) % A);
+        carry = (int) (Math.abs(c) % A);
 
         // Initial state.
         System.arraycopy(tmp, 1, state, 0, Q_SIZE);

Reply via email to