RNG-169: Update array seed conversion to use optimum seed length
authoraherbert <aherbert@apache.org>
Wed, 16 Mar 2022 14:39:06 +0000 (14:39 +0000)
committeraherbert <aherbert@apache.org>
Wed, 16 Mar 2022 14:49:46 +0000 (14:49 +0000)
commitca6f140ac7074fcacf1dcba32f071ba465875c41
tree100d0cfe38d6727a11857915971681cd0bc8f93c
parentc3c802117da90523ecc0dd1507d895ac9c3f5f54
RNG-169: Update array seed conversion to use optimum seed length

Avoid duplication of the input byte[] to zero fill it to a length
modulus 4 or 8 for conversion by the NumberFactory.

During array to array conversions only convert the minimum of the
required number of bytes for the native seed type, or the number of
input bytes.

Change all array conversions to use little-endian byte order.
14 files changed:
commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/ByteArray2IntArray.java
commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/ByteArray2LongArray.java
commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/IntArray2LongArray.java
commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/LongArray2IntArray.java
commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/NativeSeedType.java
commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/SeedUtils.java
commons-rng-simple/src/test/java/org/apache/commons/rng/simple/internal/ArrayConverterEndianTest.java [new file with mode: 0644]
commons-rng-simple/src/test/java/org/apache/commons/rng/simple/internal/ByteArray2IntArrayTest.java
commons-rng-simple/src/test/java/org/apache/commons/rng/simple/internal/ByteArray2LongArrayTest.java
commons-rng-simple/src/test/java/org/apache/commons/rng/simple/internal/IntArray2LongArrayTest.java
commons-rng-simple/src/test/java/org/apache/commons/rng/simple/internal/LongArray2IntArrayTest.java [new file with mode: 0644]
commons-rng-simple/src/test/java/org/apache/commons/rng/simple/internal/NativeSeedTypeTest.java
commons-rng-simple/src/test/java/org/apache/commons/rng/simple/internal/SeedUtilsTest.java
src/changes/changes.xml