Repository: commons-rng Updated Branches: refs/heads/master cf8e16eab -> ddfa94cbf
RNG-57: Fix parameters order. Thanks to Alex Herbert for reviewing the code and spotting the inconsistency. Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/a535cacd Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/a535cacd Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/a535cacd Branch: refs/heads/master Commit: a535cacdc470c87228e9bb6c362d7b4a72219aa6 Parents: cf8e16e Author: Gilles <er...@apache.org> Authored: Fri Oct 5 23:13:00 2018 +0200 Committer: Gilles <er...@apache.org> Committed: Fri Oct 5 23:13:00 2018 +0200 ---------------------------------------------------------------------- .../main/java/org/apache/commons/rng/core/BaseProvider.java | 6 +++--- .../org/apache/commons/rng/core/source32/AbstractWell.java | 4 ++-- .../java/org/apache/commons/rng/core/source32/ISAACRandom.java | 4 ++-- .../java/org/apache/commons/rng/core/source32/JDKRandom.java | 4 ++-- .../java/org/apache/commons/rng/core/source32/KISSRandom.java | 4 ++-- .../org/apache/commons/rng/core/source32/MersenneTwister.java | 4 ++-- .../apache/commons/rng/core/source32/MultiplyWithCarry256.java | 4 ++-- .../apache/commons/rng/core/source64/MersenneTwister64.java | 4 ++-- .../java/org/apache/commons/rng/core/source64/SplitMix64.java | 4 ++-- .../java/org/apache/commons/rng/core/source64/TwoCmres.java | 4 ++-- .../org/apache/commons/rng/core/source64/XorShift1024Star.java | 4 ++-- 11 files changed, 23 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-rng/blob/a535cacd/commons-rng-core/src/main/java/org/apache/commons/rng/core/BaseProvider.java ---------------------------------------------------------------------- diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/BaseProvider.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/BaseProvider.java index 29d3572..6bf5ee1 100644 --- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/BaseProvider.java +++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/BaseProvider.java @@ -90,15 +90,15 @@ public abstract class BaseProvider * will end with a statement like the following: * <pre> * <code> - * return composeStateInternal(super.getStateInternal(), - * state); + * return composeStateInternal(state, + * super.getStateInternal()); * </code> * </pre> * where {@code state} is the state needed and defined by the class * where the method is overridden. * - * @param parentState State of the calling class' parent. * @param state State of the calling class. + * @param parentState State of the calling class' parent. * @return the combined state. * Bytes that belong to the local state will be stored at the * beginning of the resulting array. http://git-wip-us.apache.org/repos/asf/commons-rng/blob/a535cacd/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java ---------------------------------------------------------------------- diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java index c8f57c8..8838636 100644 --- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java +++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java @@ -67,8 +67,8 @@ public abstract class AbstractWell extends IntProvider { final int[] s = Arrays.copyOf(v, v.length + 1); s[v.length] = index; - return composeStateInternal(super.getStateInternal(), - NumberFactory.makeByteArray(s)); + return composeStateInternal(NumberFactory.makeByteArray(s), + super.getStateInternal()); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/commons-rng/blob/a535cacd/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/ISAACRandom.java ---------------------------------------------------------------------- diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/ISAACRandom.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/ISAACRandom.java index 51cfd15..151b474 100644 --- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/ISAACRandom.java +++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/ISAACRandom.java @@ -94,8 +94,8 @@ public class ISAACRandom extends IntProvider { System.arraycopy(sMem, 0, s, SIZE, SIZE); System.arraycopy(sRem, 0, s, 2 * SIZE, sRem.length); - return composeStateInternal(super.getStateInternal(), - NumberFactory.makeByteArray(s)); + return composeStateInternal(NumberFactory.makeByteArray(s), + super.getStateInternal()); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/commons-rng/blob/a535cacd/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/JDKRandom.java ---------------------------------------------------------------------- diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/JDKRandom.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/JDKRandom.java index d010e5b..94ba0b4 100644 --- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/JDKRandom.java +++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/JDKRandom.java @@ -76,8 +76,8 @@ public class JDKRandom extends IntProvider { final byte[] state = bos.toByteArray(); stateSize = state.length; // To allow state recovery. - return composeStateInternal(super.getStateInternal(), - state); + return composeStateInternal(state, + super.getStateInternal()); } catch (IOException e) { // Workaround checked exception. throw new IllegalStateException(e); http://git-wip-us.apache.org/repos/asf/commons-rng/blob/a535cacd/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/KISSRandom.java ---------------------------------------------------------------------- diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/KISSRandom.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/KISSRandom.java index c50d8f0..2bf9db4 100644 --- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/KISSRandom.java +++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/KISSRandom.java @@ -55,8 +55,8 @@ public class KISSRandom extends IntProvider { /** {@inheritDoc} */ @Override protected byte[] getStateInternal() { - return composeStateInternal(super.getStateInternal(), - NumberFactory.makeByteArray(new int[] { z, w, jsr, jcong })); + return composeStateInternal(NumberFactory.makeByteArray(new int[] { z, w, jsr, jcong }), + super.getStateInternal()); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/commons-rng/blob/a535cacd/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/MersenneTwister.java ---------------------------------------------------------------------- diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/MersenneTwister.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/MersenneTwister.java index f1a8727..8cea9a2 100644 --- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/MersenneTwister.java +++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/MersenneTwister.java @@ -122,8 +122,8 @@ public class MersenneTwister extends IntProvider { final int[] s = Arrays.copyOf(mt, N + 1); s[N] = mti; - return composeStateInternal(super.getStateInternal(), - NumberFactory.makeByteArray(s)); + return composeStateInternal(NumberFactory.makeByteArray(s), + super.getStateInternal()); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/commons-rng/blob/a535cacd/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/MultiplyWithCarry256.java ---------------------------------------------------------------------- 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 28996aa..9de791e 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 @@ -65,8 +65,8 @@ public class MultiplyWithCarry256 extends IntProvider { s[SEED_SIZE - 1] = carry; s[SEED_SIZE] = index; - return composeStateInternal(super.getStateInternal(), - NumberFactory.makeByteArray(s)); + return composeStateInternal(NumberFactory.makeByteArray(s), + super.getStateInternal()); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/commons-rng/blob/a535cacd/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/MersenneTwister64.java ---------------------------------------------------------------------- diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/MersenneTwister64.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/MersenneTwister64.java index 17996b9..a8dbdc5 100644 --- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/MersenneTwister64.java +++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/MersenneTwister64.java @@ -102,8 +102,8 @@ public class MersenneTwister64 extends LongProvider { final long[] s = Arrays.copyOf(mt, NN + 1); s[NN] = mti; - return composeStateInternal(super.getStateInternal(), - NumberFactory.makeByteArray(s)); + return composeStateInternal(NumberFactory.makeByteArray(s), + super.getStateInternal()); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/commons-rng/blob/a535cacd/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/SplitMix64.java ---------------------------------------------------------------------- diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/SplitMix64.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/SplitMix64.java index eb1861b..145c874 100644 --- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/SplitMix64.java +++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/SplitMix64.java @@ -62,8 +62,8 @@ public class SplitMix64 extends LongProvider { /** {@inheritDoc} */ @Override protected byte[] getStateInternal() { - return composeStateInternal(super.getStateInternal(), - NumberFactory.makeByteArray(state)); + return composeStateInternal(NumberFactory.makeByteArray(state), + super.getStateInternal()); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/commons-rng/blob/a535cacd/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/TwoCmres.java ---------------------------------------------------------------------- diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/TwoCmres.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/TwoCmres.java index 7d052ba..11850c2 100644 --- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/TwoCmres.java +++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/TwoCmres.java @@ -119,8 +119,8 @@ public class TwoCmres extends LongProvider { /** {@inheritDoc} */ @Override protected byte[] getStateInternal() { - return composeStateInternal(super.getStateInternal(), - NumberFactory.makeByteArray(new long[] { xx, yy })); + return composeStateInternal(NumberFactory.makeByteArray(new long[] { xx, yy }), + super.getStateInternal()); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/commons-rng/blob/a535cacd/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/XorShift1024Star.java ---------------------------------------------------------------------- diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/XorShift1024Star.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/XorShift1024Star.java index af230a9..1d48896 100644 --- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/XorShift1024Star.java +++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/XorShift1024Star.java @@ -55,8 +55,8 @@ public class XorShift1024Star extends LongProvider { final long[] s = Arrays.copyOf(state, SEED_SIZE + 1); s[SEED_SIZE] = index; - return composeStateInternal(super.getStateInternal(), - NumberFactory.makeByteArray(s)); + return composeStateInternal(NumberFactory.makeByteArray(s), + super.getStateInternal()); } /** {@inheritDoc} */