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 2023/12/24 08:45:32 UTC
(commons-statistics) branch master updated (b560d2a -> 06853a9)
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-statistics.git
from b560d2a STATISTICS-81: Add integer sum of squares implementation
new d86a3c8 Consolidate creation of test source of randomness
new 06853a9 Add additional test for conversion to a double
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:
.../commons/statistics/descriptive/Int128Test.java | 4 +-
.../statistics/descriptive/IntMathTest.java | 15 ++++---
.../descriptive/IntSumOfSquaresTest.java | 3 +-
.../commons/statistics/descriptive/IntSumTest.java | 3 +-
.../descriptive/LongSumOfSquaresTest.java | 3 +-
.../statistics/descriptive/LongSumTest.java | 3 +-
.../commons/statistics/descriptive/TestHelper.java | 14 ++++++-
.../statistics/descriptive/UInt128Test.java | 11 +++---
.../statistics/descriptive/UInt192Test.java | 46 +++++++++++++++++++---
.../commons/statistics/descriptive/UInt96Test.java | 5 +--
10 files changed, 74 insertions(+), 33 deletions(-)
(commons-statistics) 02/02: Add additional test for conversion to a double
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-statistics.git
commit 06853a9ba70ee25724f8e42ab122abfd819603f5
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Sun Dec 24 08:44:50 2023 +0000
Add additional test for conversion to a double
---
.../statistics/descriptive/IntMathTest.java | 8 ++---
.../statistics/descriptive/UInt192Test.java | 37 ++++++++++++++++++++++
2 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntMathTest.java b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntMathTest.java
index c8ea420..ccc4416 100644
--- a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntMathTest.java
+++ b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntMathTest.java
@@ -99,14 +99,14 @@ class IntMathTest {
}
/**
- * Create a big integer treating the value as unsigned.
+ * Create a BigInteger treating the value as unsigned.
*
* @param v Value
- * @return the big integer
+ * @return the BigInteger
*/
- private static BigInteger toUnsignedBigInteger(long v) {
+ static BigInteger toUnsignedBigInteger(long v) {
return v < 0 ?
- TWO_POW_63.add(BigInteger.valueOf(v & Long.MAX_VALUE)) :
+ TWO_POW_63.or(BigInteger.valueOf(v & Long.MAX_VALUE)) :
BigInteger.valueOf(v);
}
diff --git a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt192Test.java b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt192Test.java
index f91067a..0edf578 100644
--- a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt192Test.java
+++ b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt192Test.java
@@ -255,4 +255,41 @@ class UInt192Test {
Assertions.assertThrows(ArithmeticException.class, () -> v5.toLongExact());
Assertions.assertEquals(0x1.0p128, v5.toDouble());
}
+
+ /**
+ * Additional cases for conversion to a double.
+ * Conversion of uint128 is done in {@link IntMathTest#testUint128ToDouble()}.
+ * This test ensures any bits in the extra 64-bits of the 192-bit value are used.
+ */
+ @ParameterizedTest
+ @MethodSource
+ void testToDouble(long a, long b, long c) {
+ final UInt192 x = new UInt192(a, b, c);
+ final double expected = IntMathTest.toUnsignedBigInteger(a).shiftLeft(128)
+ .add(IntMathTest.toUnsignedBigInteger(b).shiftLeft(64))
+ .add(IntMathTest.toUnsignedBigInteger(c)).doubleValue();
+ Assertions.assertEquals(expected, x.toDouble());
+ }
+
+ static Stream<Arguments> testToDouble() {
+ final Stream.Builder<Arguments> builder = Stream.builder();
+ final UniformRandomProvider rng = TestHelper.createRNG();
+ for (int i = 0; i < 50; i++) {
+ long a = rng.nextLong();
+ final long b = rng.nextLong();
+ final long c = rng.nextLong();
+ builder.accept(Arguments.of(a, b, c));
+ // Edge cases where trailing bits are required for rounding.
+ // Create a 55-bit number. Ensure the highest bit is set.
+ a = (a << 9) | Long.MIN_VALUE;
+ // Shift right and carry bits down.
+ final int shift = rng.nextInt(1, 64);
+ final long x = a >>> shift;
+ final long y = a << -shift;
+ builder.accept(Arguments.of(x, y, 0));
+ builder.accept(Arguments.of(x, y | 1, 0));
+ builder.accept(Arguments.of(x, y, 1));
+ }
+ return builder.build();
+ }
}
(commons-statistics) 01/02: Consolidate creation of test source of randomness
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-statistics.git
commit d86a3c82e3e9f61c034e185f1a5f3f14ded7e5ee
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Sun Dec 24 07:50:53 2023 +0000
Consolidate creation of test source of randomness
---
.../apache/commons/statistics/descriptive/Int128Test.java | 4 ++--
.../apache/commons/statistics/descriptive/IntMathTest.java | 7 +++----
.../statistics/descriptive/IntSumOfSquaresTest.java | 3 +--
.../apache/commons/statistics/descriptive/IntSumTest.java | 3 +--
.../statistics/descriptive/LongSumOfSquaresTest.java | 3 +--
.../apache/commons/statistics/descriptive/LongSumTest.java | 3 +--
.../apache/commons/statistics/descriptive/TestHelper.java | 14 +++++++++++++-
.../apache/commons/statistics/descriptive/UInt128Test.java | 11 +++++------
.../apache/commons/statistics/descriptive/UInt192Test.java | 9 ++++-----
.../apache/commons/statistics/descriptive/UInt96Test.java | 5 ++---
10 files changed, 33 insertions(+), 29 deletions(-)
diff --git a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/Int128Test.java b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/Int128Test.java
index 7a5f298..e61ed15 100644
--- a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/Int128Test.java
+++ b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/Int128Test.java
@@ -93,7 +93,7 @@ class Int128Test {
static Stream<Arguments> testAddLongs() {
final Stream.Builder<Arguments> builder = Stream.builder();
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
for (final int n : new int[] {50, 100}) {
builder.accept(Arguments.of(rng.longs(n).toArray()));
builder.accept(Arguments.of(rng.longs(n).map(x -> x >>> 2).toArray()));
@@ -145,7 +145,7 @@ class Int128Test {
static Stream<Arguments> testAddInt128() {
final Stream.Builder<Arguments> builder = Stream.builder();
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
for (int i = 0; i < 50; i++) {
builder.accept(Arguments.of(rng.nextLong() >>> 2, rng.nextLong(), rng.nextLong() >>> 2, rng.nextLong()));
builder.accept(Arguments.of(rng.nextLong() >>> 2, rng.nextLong(), rng.nextLong() >>> 1, rng.nextLong()));
diff --git a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntMathTest.java b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntMathTest.java
index c5785c0..c8ea420 100644
--- a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntMathTest.java
+++ b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntMathTest.java
@@ -24,7 +24,6 @@ import java.util.stream.LongStream;
import java.util.stream.LongStream.Builder;
import java.util.stream.Stream;
import org.apache.commons.rng.UniformRandomProvider;
-import org.apache.commons.rng.simple.RandomSource;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
@@ -48,7 +47,7 @@ class IntMathTest {
}
static LongStream testSquareHigh() {
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
final Builder builder = LongStream.builder();
builder.accept(0);
builder.accept(Long.MAX_VALUE);
@@ -78,7 +77,7 @@ class IntMathTest {
}
static Stream<Arguments> testUnsignedMultiplyHigh() {
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
final Stream.Builder<Arguments> builder = Stream.builder();
final long[] values = {
-1, 0, 1, Long.MAX_VALUE, Long.MIN_VALUE,
@@ -122,7 +121,7 @@ class IntMathTest {
}
static Stream<Arguments> testUint128ToDouble() {
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
final Stream.Builder<Arguments> builder = Stream.builder();
for (int i = 0; i < 100; i++) {
long a = rng.nextLong();
diff --git a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntSumOfSquaresTest.java b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntSumOfSquaresTest.java
index ca96658..e2255bb 100644
--- a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntSumOfSquaresTest.java
+++ b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntSumOfSquaresTest.java
@@ -76,8 +76,7 @@ final class IntSumOfSquaresTest extends BaseIntStatisticTest<IntSumOfSquares> {
@Override
protected Stream<StatisticTestData> streamTestData() {
- // A null seed will create a different RNG each time
- final UniformRandomProvider rng = TestHelper.createRNG(null);
+ final UniformRandomProvider rng = TestHelper.createRNG();
return Stream.of(
addCase(Integer.MAX_VALUE, 1, 2, 3, 4, Integer.MAX_VALUE),
addCase(Integer.MIN_VALUE, -1, -2, -3, -4, Integer.MIN_VALUE),
diff --git a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntSumTest.java b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntSumTest.java
index 27bc0d3..8abc723 100644
--- a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntSumTest.java
+++ b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/IntSumTest.java
@@ -75,8 +75,7 @@ final class IntSumTest extends BaseIntStatisticTest<IntSum> {
@Override
protected Stream<StatisticTestData> streamTestData() {
- // A null seed will create a different RNG each time
- final UniformRandomProvider rng = TestHelper.createRNG(null);
+ final UniformRandomProvider rng = TestHelper.createRNG();
return Stream.of(
addCase(Integer.MAX_VALUE, 1, 2, 3, 4, -20, Integer.MAX_VALUE),
addCase(Integer.MIN_VALUE, -1, -2, -3, -4, 20, Integer.MIN_VALUE),
diff --git a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/LongSumOfSquaresTest.java b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/LongSumOfSquaresTest.java
index 8691cf9..4624eef 100644
--- a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/LongSumOfSquaresTest.java
+++ b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/LongSumOfSquaresTest.java
@@ -76,8 +76,7 @@ final class LongSumOfSquaresTest extends BaseLongStatisticTest<LongSumOfSquares>
@Override
protected Stream<StatisticTestData> streamTestData() {
- // A null seed will create a different RNG each time
- final UniformRandomProvider rng = TestHelper.createRNG(null);
+ final UniformRandomProvider rng = TestHelper.createRNG();
return Stream.of(
addCase(Long.MAX_VALUE, 1, 2, 3, 4, Long.MAX_VALUE),
addCase(Long.MIN_VALUE, -1, -2, -3, -4, Long.MIN_VALUE),
diff --git a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/LongSumTest.java b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/LongSumTest.java
index de203f7..858b6d8 100644
--- a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/LongSumTest.java
+++ b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/LongSumTest.java
@@ -76,8 +76,7 @@ final class LongSumTest extends BaseLongStatisticTest<LongSum> {
@Override
protected Stream<StatisticTestData> streamTestData() {
- // A null seed will create a different RNG each time
- final UniformRandomProvider rng = TestHelper.createRNG(null);
+ final UniformRandomProvider rng = TestHelper.createRNG();
return Stream.of(
addCase(Long.MAX_VALUE, 1, 2, 3, 4, -20, Long.MAX_VALUE),
addCase(Long.MIN_VALUE, -1, -2, -3, -4, 20, Long.MIN_VALUE),
diff --git a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/TestHelper.java b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/TestHelper.java
index c524e36..22c385d 100644
--- a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/TestHelper.java
+++ b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/TestHelper.java
@@ -32,6 +32,8 @@ import org.junit.jupiter.api.Assertions;
* Helper class for tests in {@code o.a.c.s.descriptive} module.
*/
final class TestHelper {
+ /** Source of randomness. */
+ private static final RandomSource RANDOM_SOURCE = RandomSource.XO_RO_SHI_RO_128_PP;
/**
* Cached seed. Using the same seed ensures all statistics use the same shuffled
* data for tests executed in the same JVM.
@@ -229,6 +231,16 @@ final class TestHelper {
return SEED.clone();
}
+ /**
+ * Creates a RNG instance.
+ * This method will create a different RNG each time.
+ *
+ * @return A new RNG instance.
+ */
+ static UniformRandomProvider createRNG() {
+ return RANDOM_SOURCE.create();
+ }
+
/**
* Creates a RNG instance.
* A null seed will create a different RNG each time.
@@ -238,7 +250,7 @@ final class TestHelper {
* @see #createRNGSeed()
*/
static UniformRandomProvider createRNG(long[] seed) {
- return RandomSource.XO_RO_SHI_RO_128_PP.create(seed);
+ return RANDOM_SOURCE.create(seed);
}
/**
diff --git a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt128Test.java b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt128Test.java
index 1209daf..0c24df2 100644
--- a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt128Test.java
+++ b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt128Test.java
@@ -21,7 +21,6 @@ import java.math.BigInteger;
import java.util.Arrays;
import java.util.stream.Stream;
import org.apache.commons.rng.UniformRandomProvider;
-import org.apache.commons.rng.simple.RandomSource;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
@@ -93,7 +92,7 @@ class UInt128Test {
static Stream<Arguments> testAddLongs() {
final Stream.Builder<Arguments> builder = Stream.builder();
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
for (final int n : new int[] {50, 100}) {
builder.accept(Arguments.of(rng.longs(n).map(x -> x >>> 1).toArray()));
builder.accept(Arguments.of(rng.longs(n).map(x -> x >>> 2).toArray()));
@@ -136,7 +135,7 @@ class UInt128Test {
static Stream<Arguments> testAddInt128() {
final Stream.Builder<Arguments> builder = Stream.builder();
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
for (int i = 0; i < 50; i++) {
builder.accept(Arguments.of(rng.nextLong() >>> 2, rng.nextLong(), rng.nextLong() >>> 2, rng.nextLong()));
builder.accept(Arguments.of(rng.nextLong() >>> 2, rng.nextLong(), rng.nextLong() >>> 1, rng.nextLong()));
@@ -156,7 +155,7 @@ class UInt128Test {
static Stream<Arguments> testOfInt96() {
final Stream.Builder<Arguments> builder = Stream.builder();
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
for (int i = 0; i < 50; i++) {
final long a = rng.nextLong();
final int b = rng.nextInt();
@@ -188,7 +187,7 @@ class UInt128Test {
static Stream<Arguments> testMultiplyInt() {
final Stream.Builder<Arguments> builder = Stream.builder();
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
final int[] x = {0, 1, -1, Integer.MAX_VALUE, Integer.MIN_VALUE};
for (int i = 0; i < 50; i++) {
final long a = rng.nextLong();
@@ -223,7 +222,7 @@ class UInt128Test {
static Stream<Arguments> testSubtract() {
final Stream.Builder<Arguments> builder = Stream.builder();
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
for (int i = 0; i < 50; i++) {
final long a = rng.nextLong();
final long b = rng.nextLong();
diff --git a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt192Test.java b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt192Test.java
index c864b45..f91067a 100644
--- a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt192Test.java
+++ b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt192Test.java
@@ -21,7 +21,6 @@ import java.math.BigInteger;
import java.util.Arrays;
import java.util.stream.Stream;
import org.apache.commons.rng.UniformRandomProvider;
-import org.apache.commons.rng.simple.RandomSource;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
@@ -79,7 +78,7 @@ class UInt192Test {
static Stream<Arguments> testAddSquareLongs() {
final Stream.Builder<Arguments> builder = Stream.builder();
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
for (final int n : new int[] {50, 100}) {
builder.accept(Arguments.of(rng.longs(n).map(x -> x >>> 1).toArray()));
builder.accept(Arguments.of(rng.longs(n).map(x -> x >>> 2).toArray()));
@@ -121,7 +120,7 @@ class UInt192Test {
static Stream<Arguments> testAddInt192() {
final Stream.Builder<Arguments> builder = Stream.builder();
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
for (int i = 0; i < 50; i++) {
builder.accept(Arguments.of(rng.nextLong() >>> 2, rng.nextLong(), rng.nextLong(),
rng.nextLong() >>> 2, rng.nextLong(), rng.nextLong()));
@@ -156,7 +155,7 @@ class UInt192Test {
static Stream<Arguments> testMultiplyInt() {
final Stream.Builder<Arguments> builder = Stream.builder();
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
final int[] x = {0, 1, -1, Integer.MAX_VALUE, Integer.MIN_VALUE};
for (int i = 0; i < 50; i++) {
final long a = rng.nextLong();
@@ -191,7 +190,7 @@ class UInt192Test {
static Stream<Arguments> testSubtract() {
final Stream.Builder<Arguments> builder = Stream.builder();
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
for (int i = 0; i < 50; i++) {
final long a = rng.nextLong();
final long b = rng.nextLong();
diff --git a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt96Test.java b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt96Test.java
index f198ab7..34d67a1 100644
--- a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt96Test.java
+++ b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/UInt96Test.java
@@ -21,7 +21,6 @@ import java.math.BigInteger;
import java.util.Arrays;
import java.util.stream.Stream;
import org.apache.commons.rng.UniformRandomProvider;
-import org.apache.commons.rng.simple.RandomSource;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
@@ -89,7 +88,7 @@ class UInt96Test {
static Stream<Arguments> testAddLongs() {
final Stream.Builder<Arguments> builder = Stream.builder();
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
for (final int n : new int[] {50, 100}) {
builder.accept(Arguments.of(rng.longs(n).map(x -> x >>> 1).toArray()));
builder.accept(Arguments.of(rng.longs(n).map(x -> x >>> 2).toArray()));
@@ -128,7 +127,7 @@ class UInt96Test {
static Stream<Arguments> testAddInt128() {
final Stream.Builder<Arguments> builder = Stream.builder();
- final UniformRandomProvider rng = RandomSource.XO_RO_SHI_RO_128_PP.create();
+ final UniformRandomProvider rng = TestHelper.createRNG();
for (int i = 0; i < 50; i++) {
builder.accept(Arguments.of(rng.nextLong() >>> 2, rng.nextInt(), rng.nextLong() >>> 2, rng.nextInt()));
builder.accept(Arguments.of(rng.nextLong() >>> 2, rng.nextInt(), rng.nextLong() >>> 1, rng.nextInt()));