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 2019/07/30 12:42:45 UTC

[commons-rng] branch master updated (70002ec -> 3660516)

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 70002ec  Update test p-value from 0.01 to 0.0001.
     new 070d563  RNG-84 : Add members of the PCG suite of generators
     new 3660516  RNG-84: Track changes.

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/rng/core/source32/AbstractPcg6432.java | 108 +++++++++++++++++++++
 .../AbstractPcgMcg6432.java}                       |  60 ++++++------
 .../{RandomIntSource.java => PcgMcgXshRr32.java}   |  27 ++++--
 .../{RandomIntSource.java => PcgMcgXshRs32.java}   |  27 ++++--
 .../commons/rng/core/source32/PcgXshRr32.java      |  47 +++++++++
 .../commons/rng/core/source32/PcgXshRs32.java      |  47 +++++++++
 .../commons/rng/core/source64/PcgRxsMXs64.java     | 105 ++++++++++++++++++++
 .../org/apache/commons/rng/core/ProvidersList.java |  10 ++
 .../rng/core/source32/PcgMcgXshRr32Test.java       |  44 +++++++++
 .../rng/core/source32/PcgMcgXshRs32Test.java       |  44 +++++++++
 .../commons/rng/core/source32/PcgXshRr32Test.java  |  44 +++++++++
 .../commons/rng/core/source32/PcgXshRs32Test.java  |  44 +++++++++
 .../commons/rng/core/source64/PcgRxsMXs64Test.java |  44 +++++++++
 .../commons/rng/examples/jmh/BaselineSources.java  |   5 +
 .../rng/examples/jmh/RandomSourceValues.java       |   5 +
 .../apache/commons/rng/simple/RandomSource.java    |  42 +++++++-
 .../rng/simple/internal/ProviderBuilder.java       |  27 +++++-
 .../apache/commons/rng/simple/ProvidersList.java   |   5 +
 src/changes/changes.xml                            |   5 +
 19 files changed, 698 insertions(+), 42 deletions(-)
 create mode 100644 commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractPcg6432.java
 copy commons-rng-core/src/main/java/org/apache/commons/rng/core/{source64/SplitMix64.java => source32/AbstractPcgMcg6432.java} (50%)
 copy commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/{RandomIntSource.java => PcgMcgXshRr32.java} (52%)
 copy commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/{RandomIntSource.java => PcgMcgXshRs32.java} (52%)
 create mode 100644 commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/PcgXshRr32.java
 create mode 100644 commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/PcgXshRs32.java
 create mode 100644 commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/PcgRxsMXs64.java
 create mode 100644 commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgMcgXshRr32Test.java
 create mode 100644 commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgMcgXshRs32Test.java
 create mode 100644 commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgXshRr32Test.java
 create mode 100644 commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgXshRs32Test.java
 create mode 100644 commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/PcgRxsMXs64Test.java


[commons-rng] 01/02: RNG-84 : Add members of the PCG suite of generators

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 070d5637f44230bff1c3f3cd675b8fc5bf3748ab
Author: AbhishekSinghDhadwal <ab...@hotmail.com>
AuthorDate: Tue Jul 30 13:32:17 2019 +0100

    RNG-84 : Add members of the PCG suite of generators
    
    Added the LCG and MCG 32 bit output versions of the XSH-RS and XSH-RR
    operations, along with the 64 bit RXS-M-XS edition.
---
 .../commons/rng/core/source32/AbstractPcg6432.java | 108 +++++++++++++++++++++
 .../rng/core/source32/AbstractPcgMcg6432.java      |  81 ++++++++++++++++
 .../commons/rng/core/source32/PcgMcgXshRr32.java   |  45 +++++++++
 .../commons/rng/core/source32/PcgMcgXshRs32.java   |  45 +++++++++
 .../commons/rng/core/source32/PcgXshRr32.java      |  47 +++++++++
 .../commons/rng/core/source32/PcgXshRs32.java      |  47 +++++++++
 .../commons/rng/core/source64/PcgRxsMXs64.java     | 105 ++++++++++++++++++++
 .../org/apache/commons/rng/core/ProvidersList.java |  10 ++
 .../rng/core/source32/PcgMcgXshRr32Test.java       |  44 +++++++++
 .../rng/core/source32/PcgMcgXshRs32Test.java       |  44 +++++++++
 .../commons/rng/core/source32/PcgXshRr32Test.java  |  44 +++++++++
 .../commons/rng/core/source32/PcgXshRs32Test.java  |  44 +++++++++
 .../commons/rng/core/source64/PcgRxsMXs64Test.java |  44 +++++++++
 .../commons/rng/examples/jmh/BaselineSources.java  |   5 +
 .../rng/examples/jmh/RandomSourceValues.java       |   5 +
 .../apache/commons/rng/simple/RandomSource.java    |  42 +++++++-
 .../rng/simple/internal/ProviderBuilder.java       |  27 +++++-
 .../apache/commons/rng/simple/ProvidersList.java   |   5 +
 18 files changed, 790 insertions(+), 2 deletions(-)

diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractPcg6432.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractPcg6432.java
new file mode 100644
index 0000000..4b7e193
--- /dev/null
+++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractPcg6432.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rng.core.source32;
+
+import org.apache.commons.rng.core.util.NumberFactory;
+/**
+ * This class aids in implementation of the PCG suite of generators, a family of
+ * simple fast space-efficient statistically good algorithms for random number generation.
+ *
+ * @see <a href="http://www.pcg-random.org/">
+ *  PCG, A Family of Better Random Number Generators</a>
+ * @since 1.3
+ */
+abstract class AbstractPcg6432 extends IntProvider {
+    /** Size of the seed array. */
+    private static final int SEED_SIZE = 2;
+
+    /** Displays the current state. */
+    private long state;
+
+    /** Used as a part of the LCG. */
+    private long increment;
+
+    /**
+     * Creates a new instance.
+     *
+     * @param seed Initial seed.
+     * If the length is larger than 2, only the first 2 elements will
+     * be used; if smaller, the remaining elements will be automatically set.
+     */
+    AbstractPcg6432(long[] seed) {
+        if (seed.length < SEED_SIZE) {
+            final long[] tmp = new long[SEED_SIZE];
+            fillState(tmp, seed);
+            setSeedInternal(tmp);
+        } else {
+            setSeedInternal(seed);
+        }
+    }
+
+    /**
+     * Modifies input parameters into current state.
+     * @param seed the new seed.
+     */
+    private void setSeedInternal(long[] seed) {
+        // Ensuring that the increment is odd to provide a maximal period LCG.
+        this.increment = (seed[1] << 1) | 1;
+        this.state = bump(seed[0] + this.increment);
+    }
+
+    /**
+     * Provides the next state of the LCG.
+     * @param input - The previous state of the generator.
+     * @return Next state of the LCG.
+     */
+    private long bump(long input) {
+        return input * 6364136223846793005L + increment;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public int next() {
+        final long x = state;
+        state = bump(state);
+        return transform(x);
+    }
+
+    /**
+     * The transformation function shall vary with respect to different generators.
+     * @param x The input.
+     * @return The output of the generator.
+     */
+    protected abstract int transform(long x);
+
+    /** {@inheritDoc} */
+    @Override
+    protected byte[] getStateInternal() {
+        /*This transform is used in the reference PCG code; it prevents restoring from
+         a byte state a non-odd increment that results in a sub-maximal period generator.*/
+        return composeStateInternal(NumberFactory.makeByteArray(
+                new long[] {state, increment >>> 1}),
+                super.getStateInternal());
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected void setStateInternal(byte[] s) {
+        final byte[][] c = splitStateInternal(s, SEED_SIZE * 8);
+        final long[] tempseed = NumberFactory.makeLongArray(c[0]);
+        state = tempseed[0];
+        increment = tempseed[1] << 1 | 1;
+        super.setStateInternal(c[1]);
+    }
+}
diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractPcgMcg6432.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractPcgMcg6432.java
new file mode 100644
index 0000000..7675307
--- /dev/null
+++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractPcgMcg6432.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rng.core.source32;
+
+import org.apache.commons.rng.core.util.NumberFactory;
+/**
+ * This class aids in implementation of the Multiplicative congruential generator (MCG)
+ * versions of the PCG suite of generators, a family of simple fast space-efficient statistically
+ * good algorithms for random number generation.
+ *
+ * @see <a href="http://www.pcg-random.org/">
+ *  PCG, A Family of Better Random Number Generators</a>
+ * @since 1.3
+ */
+abstract class AbstractPcgMcg6432 extends IntProvider {
+
+    /** Displays the current state. */
+    private long state;
+
+    /**
+     * Creates a new instance.
+     *
+     * @param seed Initial seed.
+     */
+    AbstractPcgMcg6432(Long seed) {
+        state = seed | 3;
+    }
+
+    /**
+     * Provides the next state of the MCG.
+     * @param input - The previous state of the generator.
+     * @return Next state of the MCG.
+     */
+    private long bump(long input) {
+        return input * 6364136223846793005L;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public int next() {
+        final long x = state;
+        state = bump(state);
+        return transform(x);
+    }
+
+    /**
+     * The transformation function shall vary with respect to different generators.
+     * @param x The input.
+     * @return The output of the generator.
+     */
+    protected abstract int transform(long x);
+
+    /** {@inheritDoc} */
+    @Override
+    protected byte[] getStateInternal() {
+        return composeStateInternal(NumberFactory.makeByteArray(state),
+                super.getStateInternal());
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected void setStateInternal(byte[] s) {
+        final byte[][] d = splitStateInternal(s, 8);
+        state = NumberFactory.makeLong(d[0]) | 3;
+        super.setStateInternal(d[1]);
+    }
+}
diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/PcgMcgXshRr32.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/PcgMcgXshRr32.java
new file mode 100644
index 0000000..b2e6a17
--- /dev/null
+++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/PcgMcgXshRr32.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rng.core.source32;
+
+/**
+ * A Permutated Congruential Generator (PCG) that is composed of a 64-bit Multiplicative Congruential
+ * Generator (MCG) combined with the XSH-RR (high xorshift, followed by a random rotate) output
+ * transformation to create 32-bit output.
+ * State size is 64 bits and the period is 2<sup>62</sup>.
+ *
+ * @see <a href="http://www.pcg-random.org/">
+ *  PCG, A Family of Better Random Number Generators</a>
+ * @since 1.3
+ */
+public class PcgMcgXshRr32 extends AbstractPcgMcg6432 {
+    /**
+     * Creates a new instance.
+     *
+     * @param seed Initial seed.
+     */
+    public PcgMcgXshRr32(Long seed) {
+        super(seed);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected int transform(long x) {
+        final int count = (int)(x >>> 59);
+        return Integer.rotateRight((int)((x ^ (x >>> 18)) >>> 27), count);
+    }
+}
diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/PcgMcgXshRs32.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/PcgMcgXshRs32.java
new file mode 100644
index 0000000..95cbad8
--- /dev/null
+++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/PcgMcgXshRs32.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rng.core.source32;
+
+/**
+ * A Permutated Congruential Generator (PCG) that uses a 64-bit Multiplicative Congruential
+ * Generator (MCG) combined with the XSH-RS (high xorshift, followed by a random shift) output
+ * transformation to create 32-bit output.
+ * State size is 64 bits and the period is 2<sup>62</sup>.
+ *
+ * @see <a href="http://www.pcg-random.org/">
+ *  PCG, A Family of Better Random Number Generators</a>
+ * @since 1.3
+ */
+public class PcgMcgXshRs32 extends AbstractPcgMcg6432 {
+    /**
+     * Creates a new instance.
+     *
+     * @param seed Initial seed.
+     */
+    public PcgMcgXshRs32(Long seed) {
+        super(seed);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected int transform(long x) {
+        final int count = (int)(x >>> 61);
+        return (int)((x ^ (x >>> 22)) >>> (22 + count));
+    }
+}
diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/PcgXshRr32.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/PcgXshRr32.java
new file mode 100644
index 0000000..2a4f16a
--- /dev/null
+++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/PcgXshRr32.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rng.core.source32;
+
+/**
+ * A Permutated Congruential Generator (PCG) that is composed of a 64-bit Linear Congruential
+ * Generator (LCG) combined with the XSH-RR (high xorshift, followed by a random rotate) output
+ * transformation to create 32-bit output.
+ * State size is 128 bits and the period is 2<sup>64</sup>.
+ *
+ * @see <a href="http://www.pcg-random.org/">
+ *  PCG, A Family of Better Random Number Generators</a>
+ * @since 1.3
+ */
+public class PcgXshRr32 extends AbstractPcg6432 {
+    /**
+     * Creates a new instance.
+     *
+     * @param seed Initial seed.
+     * If the length is larger than 2, only the first 2 elements will
+     * be used; if smaller, the remaining elements will be automatically set.
+     */
+    public PcgXshRr32(long[] seed) {
+        super(seed);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected int transform(long x) {
+        final int count = (int)(x >>> 59);
+        return Integer.rotateRight((int)((x ^ (x >>> 18)) >>> 27), count);
+    }
+}
diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/PcgXshRs32.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/PcgXshRs32.java
new file mode 100644
index 0000000..61c971f
--- /dev/null
+++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/PcgXshRs32.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rng.core.source32;
+
+/**
+ * A Permutated Congruential Generator (PCG) that uses a 64-bit Linear Congruential
+ * Generator (LCG) combined with the XSH-RS (high xorshift, followed by a random shift) output
+ * transformation to create 32-bit output.
+ * State size is 128 bits and the period is 2<sup>64</sup>.
+ *
+ * @see <a href="http://www.pcg-random.org/">
+ *  PCG, A Family of Better Random Number Generators</a>
+ * @since 1.3
+ */
+public class PcgXshRs32 extends AbstractPcg6432 {
+    /**
+     * Creates a new instance.
+     *
+     * @param seed Initial seed.
+     * If the length is larger than 2, only the first 2 elements will
+     * be used; if smaller, the remaining elements will be automatically set.
+     */
+    public PcgXshRs32(long[] seed) {
+        super(seed);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+   protected int transform(long x) {
+        final int count = (int)(x >>> 61);
+        return (int)((x ^ (x >>> 22)) >>> (22 + count));
+    }
+}
diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/PcgRxsMXs64.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/PcgRxsMXs64.java
new file mode 100644
index 0000000..4ae7ed5
--- /dev/null
+++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source64/PcgRxsMXs64.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rng.core.source64;
+
+import org.apache.commons.rng.core.util.NumberFactory;
+/**
+ * A Permutated Congruential Generator (PCG) that uses a 64-bit Linear Congruential Generator
+ * (LCG) combined with the RXS-M-XS (random xorshift, multiply, fixed xorshift) output transformation
+ * to create 64-bit output.
+ * State size is 128 bits and the period is 2<sup>64</sup>.
+ *
+ * @see <a href="http://www.pcg-random.org/">
+ *  PCG, A Family of Better Random Number Generators</a>
+ * @since 1.3
+ */
+public class PcgRxsMXs64 extends LongProvider {
+
+    /** Size of the seed array. */
+    private static final int SEED_SIZE = 2;
+
+    /** Displays the current state. */
+    private long state;
+
+    /** Used as a part of the LCG. */
+    private long increment;
+
+    /**
+     * Creates a new instance.
+     *
+     * @param seed Initial seed.
+     * If the length is larger than 2, only the first 2 elements will
+     * be used; if smaller, the remaining elements will be automatically set.
+     */
+    public PcgRxsMXs64(long[] seed) {
+        if (seed.length < SEED_SIZE) {
+            final long[] tmp = new long[SEED_SIZE];
+            fillState(tmp, seed);
+            setSeedInternal(tmp);
+        } else {
+            setSeedInternal(seed);
+        }
+    }
+
+    /**
+     * Modifies input parameters into current state.
+     * @param seed the new seed.
+     */
+    private void setSeedInternal(long[] seed) {
+        // Ensuring that the increment is odd to provide a maximal period LCG.
+        this.increment = (seed[1] << 1) | 1;
+        this.state = bump(seed[0] + this.increment);
+    }
+
+    /**
+     * Provides the next state of the LCG.
+     * @param input - The previous state of the generator.
+     * @return Next state of the LCG.
+     */
+    private long bump(long input) {
+        return input * 6364136223846793005L + increment;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public long next() {
+        final long x = state;
+        state = bump(state);
+        final long word = ((x >>> ((x >>> 59) + 5)) ^ x) * -5840758589994634535L;
+        return (word >>> 43) ^ word;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected byte[] getStateInternal() {
+        /*This transform is used in the reference PCG code; it prevents restoring from
+         a byte state a non-odd increment that results in a sub-maximal period generator.*/
+        return composeStateInternal(NumberFactory.makeByteArray(
+                new long[] {state, increment >>> 1}),
+                super.getStateInternal());
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected void setStateInternal(byte[] s) {
+        final byte[][] c = splitStateInternal(s, SEED_SIZE * 8);
+        final long[] tempseed = NumberFactory.makeLongArray(c[0]);
+        state = tempseed[0];
+        increment = tempseed[1] << 1 | 1;
+        super.setStateInternal(c[1]);
+    }
+}
diff --git a/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersList.java b/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersList.java
index 576b6b6..1c00bfb 100644
--- a/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersList.java
+++ b/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersList.java
@@ -36,6 +36,10 @@ import org.apache.commons.rng.core.source32.ISAACRandom;
 import org.apache.commons.rng.core.source32.MersenneTwister;
 import org.apache.commons.rng.core.source32.MultiplyWithCarry256;
 import org.apache.commons.rng.core.source32.KISSRandom;
+import org.apache.commons.rng.core.source32.PcgXshRr32;
+import org.apache.commons.rng.core.source32.PcgXshRs32;
+import org.apache.commons.rng.core.source32.PcgMcgXshRr32;
+import org.apache.commons.rng.core.source32.PcgMcgXshRs32;
 import org.apache.commons.rng.core.source64.SplitMix64;
 import org.apache.commons.rng.core.source64.XorShift1024Star;
 import org.apache.commons.rng.core.source64.XorShift1024StarPhi;
@@ -47,6 +51,7 @@ import org.apache.commons.rng.core.source64.XoShiRo256StarStar;
 import org.apache.commons.rng.core.source64.XoShiRo512Plus;
 import org.apache.commons.rng.core.source64.XoShiRo512StarStar;
 import org.apache.commons.rng.core.source64.MersenneTwister64;
+import org.apache.commons.rng.core.source64.PcgRxsMXs64;
 import org.apache.commons.rng.JumpableUniformRandomProvider;
 import org.apache.commons.rng.RestorableUniformRandomProvider;
 
@@ -94,6 +99,10 @@ public final class ProvidersList {
             add(LIST32, new XoRoShiRo64StarStar(new int[] {g.nextInt(), g.nextInt(), g.nextInt()}));
             add(LIST32, new XoShiRo128Plus(new int[] {g.nextInt(), g.nextInt(), g.nextInt()}));
             add(LIST32, new XoShiRo128StarStar(new int[] {g.nextInt(), g.nextInt(), g.nextInt()}));
+            add(LIST32, new PcgXshRr32(new long[] {g.nextLong()}));
+            add(LIST32, new PcgXshRs32(new long[] {g.nextLong()}));
+            add(LIST32, new PcgMcgXshRr32(g.nextLong()));
+            add(LIST32, new PcgMcgXshRs32(g.nextLong()));
             // ... add more here.
 
             // "long"-based RNGs.
@@ -109,6 +118,7 @@ public final class ProvidersList {
             add(LIST64, new XoShiRo256StarStar(new long[] {g.nextLong(), g.nextLong(), g.nextLong(), g.nextLong()}));
             add(LIST64, new XoShiRo512Plus(new long[] {g.nextLong(), g.nextLong(), g.nextLong(), g.nextLong()}));
             add(LIST64, new XoShiRo512StarStar(new long[] {g.nextLong(), g.nextLong(), g.nextLong(), g.nextLong()}));
+            add(LIST64, new PcgRxsMXs64(new long[] {g.nextLong()}));
             // ... add more here.
 
             // Do not modify the remaining statements.
diff --git a/commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgMcgXshRr32Test.java b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgMcgXshRr32Test.java
new file mode 100644
index 0000000..5ca5a50
--- /dev/null
+++ b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgMcgXshRr32Test.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.rng.core.source32;
+
+import org.apache.commons.rng.core.RandomAssert;
+import org.junit.Test;
+
+public class PcgMcgXshRr32Test {
+    @Test
+    public void testReferenceCode() {
+        /*
+         * Tested with respect to pcg_engines::mcg_xsh_rr_64_32 of the C++ implementation.
+         * See : http://www.pcg-random.org/download.html#cpp-implementation
+         */
+        final int[] expectedSequence = {
+            0x25bc3e38, 0xb0693d58, 0x155b98f0, 0x047e13d7,
+            0xcfb227b3, 0x66601632, 0x71c6e68b, 0x16e2d4a7,
+            0x65412358, 0x6d39102c, 0x545cebed, 0x577695ef,
+            0xc851c202, 0x743d50b6, 0xe1876a24, 0x274ae9e1,
+            0x4087af7b, 0xd4738e89, 0x6ae6e6cf, 0xf8716a43,
+            0x933ed380, 0x3edb0d15, 0xa3716e23, 0x2d5f81f2,
+            0x5a921ac5, 0x795ec1cf, 0x42595831, 0x55a39a40,
+            0x9a21afda, 0xc03fa331, 0x9192fd98, 0x87eb7041,
+            0x2d9e338e, 0xf924d873, 0xf8c6a7a7, 0x2dfe78bf,
+            0xd443c0a9, 0xe567f8ed, 0xa4e09491, 0x3c91d8fd,
+        };
+        RandomAssert.assertEquals(expectedSequence, new PcgMcgXshRr32(0x012de1babb3c4104L));
+    }
+}
diff --git a/commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgMcgXshRs32Test.java b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgMcgXshRs32Test.java
new file mode 100644
index 0000000..faf3062
--- /dev/null
+++ b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgMcgXshRs32Test.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.rng.core.source32;
+
+import org.apache.commons.rng.core.RandomAssert;
+import org.junit.Test;
+
+public class PcgMcgXshRs32Test {
+    @Test
+    public void testReferenceCode() {
+        /*
+         * Tested with respect to pcg_engines::mcg_xsh_rs_64_32 of the C++ implementation.
+         * See : http://www.pcg-random.org/download.html#cpp-implementation
+         */
+        final int[] expectedSequence = {
+            0xb786f832, 0x6920834f, 0x5b88b399, 0x6b811447,
+            0x91230c70, 0x163c83b5, 0x8dd8bba9, 0xb8bcd10a,
+            0xe1964b6e, 0x40b9adc8, 0x75fbee87, 0xed3d1e5c,
+            0x82cb437b, 0xea94cea8, 0x76b1726a, 0x9275544a,
+            0xed015249, 0x9d46c1cc, 0xe6fddd59, 0x487a0912,
+            0xa709c922, 0xd15ac2a2, 0xba36e687, 0x3e40b099,
+            0x62ae602c, 0xec0ebb27, 0x94246eda, 0xa40c2daa,
+            0xd7e0abb5, 0xf8061587, 0x97f2132a, 0x861cfa5e,
+            0xc5b2280b, 0x5fc8ec4e, 0xa9e552ed, 0xbf2ee34f,
+            0x0a945eb3, 0x9e578662, 0x292cf72c, 0xc7e04668,
+        };
+        RandomAssert.assertEquals(expectedSequence, new PcgMcgXshRs32(0x012de1babb3c4104L));
+    }
+}
diff --git a/commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgXshRr32Test.java b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgXshRr32Test.java
new file mode 100644
index 0000000..ed2b52f
--- /dev/null
+++ b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgXshRr32Test.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.rng.core.source32;
+
+import org.apache.commons.rng.core.RandomAssert;
+import org.junit.Test;
+
+public class PcgXshRr32Test {
+    @Test
+    public void testReferenceCode() {
+        /*
+         * Tested with respect to pcg_engines::setseq_xsh_rr_64_32 of the C++ implementation.
+         * See : http://www.pcg-random.org/download.html#cpp-implementation
+         */
+        final int[] expectedSequence = {
+            0xe860dd24, 0x15d339c0, 0xd9f75c46, 0x00efabb7,
+            0xa625e97f, 0xcdeae599, 0x6304e667, 0xbc81be11,
+            0x2b8ea285, 0x8e186699, 0xac552be9, 0xd1ae72e5,
+            0x5b953ad4, 0xa061dc1b, 0x526006e7, 0xf5a6c623,
+            0xfcefea93, 0x3a1964d2, 0xd6f03237, 0xf3e493f7,
+            0x0c733750, 0x34a73582, 0xc4f8807b, 0x92b741ca,
+            0x0d38bf9c, 0xc39ee6ad, 0xdc24857b, 0x7ba8f7d8,
+            0x377a2618, 0x92d83d3f, 0xd22a957a, 0xb6724af4,
+            0xe116141a, 0xf465fe45, 0xa95f35bb, 0xf0398d4d,
+            0xe880af3e, 0xc2951dfd, 0x984ec575, 0x8679addb,
+        };
+        RandomAssert.assertEquals(expectedSequence, new PcgXshRr32(new long[] {0x012de1babb3c4104L, 0xc8161b4202294965L}));
+    }
+}
diff --git a/commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgXshRs32Test.java b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgXshRs32Test.java
new file mode 100644
index 0000000..e72ca67
--- /dev/null
+++ b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source32/PcgXshRs32Test.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.rng.core.source32;
+
+import org.apache.commons.rng.core.RandomAssert;
+import org.junit.Test;
+
+public class PcgXshRs32Test {
+    @Test
+    public void testReferenceCode() {
+        /*
+         * Tested with respect to pcg_engines::setseq_xsh_rs_64_32 from the C++ implementation.
+         * See : http://www.pcg-random.org/download.html#cpp-implementation
+         */
+        final int[] expectedSequence = {
+            0xba4138b8, 0xd329a393, 0x75d68d3f, 0xbb7572ca,
+            0x7a48d2f2, 0xcb3c1e37, 0xc1374a97, 0x7c2c5bfa,
+            0x8a1c8695, 0x30db4fea, 0x95f9a901, 0x72ebfa48,
+            0x6a284dbf, 0x0ef11286, 0x37330e11, 0xfeb53893,
+            0x77e3adda, 0x64dc86bd, 0xc8d762d7, 0xbf3fb80c,
+            0x732dfd12, 0x6088e86d, 0xbc4e79e5, 0x56ece5b1,
+            0xe706ac72, 0xee798018, 0xef73de74, 0x3de1f966,
+            0x7a36db53, 0x1e921eb2, 0x55e35484, 0x2577c6f2,
+            0x0a006e21, 0x8cb811b7, 0x5f26c916, 0x3990837f,
+            0x15f2983d, 0x546ccb4a, 0x4eda8716, 0xb8666a25,
+        };
+        RandomAssert.assertEquals(expectedSequence, new PcgXshRs32(new long[] {0x012de1babb3c4104L, 0xc8161b4202294965L}));
+    }
+}
diff --git a/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/PcgRxsMXs64Test.java b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/PcgRxsMXs64Test.java
new file mode 100644
index 0000000..14149b6
--- /dev/null
+++ b/commons-rng-core/src/test/java/org/apache/commons/rng/core/source64/PcgRxsMXs64Test.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.rng.core.source64;
+
+import org.apache.commons.rng.core.RandomAssert;
+import org.junit.Test;
+
+public class PcgRxsMXs64Test {
+    @Test
+    public void testReferenceCode() {
+        /*
+         * Tested with respect to pcg_engines::setseq_rxs_m_xs_64_64 of the C++ implementation.
+         * See : http://www.pcg-random.org/download.html#cpp-implementation
+         */
+        final long[] expectedSequence = {
+            0xc147f2291fa40ccfL, 0x8edbcbf8a5f49877L, 0x61e05a1d5213f0b4L, 0xc039f9369032e638L,
+            0x95146e605b2e4a96L, 0x5480af6332262d03L, 0x7cbfb3a67a714557L, 0x5c9f0a25eba41575L,
+            0x6e23dba403318decL, 0x7b230e581b829dbcL, 0x0617d61457cce844L, 0x661c9bd85d60eb09L,
+            0x48acc16a0113d8f1L, 0xd7c6a4b516ccf126L, 0x85e72ab4e1819cfbL, 0x578cfcc9d7f55036L,
+            0xcfc87f2b332b581dL, 0x50db098980bb8bf4L, 0xe50bab9f780884d5L, 0xbcd91f1aa5240febL,
+            0xf45c3398207f4f55L, 0x390a6132c0e31e56L, 0x0594d18864e34a6aL, 0x10268ae6df979e24L,
+            0x69bc35b3539195eeL, 0x4931c30cf8c9342fL, 0x63bc344007b30e4aL, 0x6da4c43e42bdf49eL,
+            0x9a52bbf48ebbcd52L, 0xd7e0040b82efa84fL, 0xd601c8e7917a1db9L, 0xb905ecaf6864e799L,
+            0x32877df7625ae7b5L, 0xa3dc41742161f87dL, 0x9556e15438c1aca1L, 0xb2c890ac0e32cd37L,
+            0xf1d53427ff980d09L, 0x0e227593be626d22L, 0x0fcbdacbf19d6ae1L, 0xe425b9f0345bd813L,
+        };
+        RandomAssert.assertEquals(expectedSequence, new PcgRxsMXs64(new long[] {0x012de1babb3c4104L, 0xc8161b4202294965L}));
+    }
+}
diff --git a/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/BaselineSources.java b/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/BaselineSources.java
index b3cbcab..9404e1b 100644
--- a/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/BaselineSources.java
+++ b/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/BaselineSources.java
@@ -87,6 +87,11 @@ public abstract class BaselineSources {
             "XO_SHI_RO_256_SS",
             "XO_SHI_RO_512_PLUS",
             "XO_SHI_RO_512_SS",
+            "PCG_XSH_RR_32",
+            "PCG_XSH_RS_32",
+            "PCG_RXS_M_XS_64",
+            "PCG_MCG_XSH_RR_32",
+            "PCG_MCG_XSH_RS_32",
             })
     private String randomSourceName;
 
diff --git a/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/RandomSourceValues.java b/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/RandomSourceValues.java
index 823162c..9b0c6a1 100644
--- a/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/RandomSourceValues.java
+++ b/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/RandomSourceValues.java
@@ -65,6 +65,11 @@ public class RandomSourceValues {
             "XO_SHI_RO_256_SS",
             "XO_SHI_RO_512_PLUS",
             "XO_SHI_RO_512_SS",
+            "PCG_XSH_RR_32",
+            "PCG_XSH_RS_32",
+            "PCG_RXS_M_XS_64",
+            "PCG_MCG_XSH_RR_32",
+            "PCG_MCG_XSH_RS_32",
             })
     private String randomSourceName;
 
diff --git a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/RandomSource.java b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/RandomSource.java
index 73277a5..af160b3 100644
--- a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/RandomSource.java
+++ b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/RandomSource.java
@@ -386,7 +386,47 @@ public enum RandomSource {
      *  <li>Native seed size: 8.</li>
      * </ul>
      */
-    XO_SHI_RO_512_SS(ProviderBuilder.RandomSourceInternal.XO_SHI_RO_512_SS);
+    XO_SHI_RO_512_SS(ProviderBuilder.RandomSourceInternal.XO_SHI_RO_512_SS),
+    /**
+     * Source of randomness is {@link org.apache.commons.rng.core.source32.PcgXshRr32}.
+     * <ul>
+     *  <li>Native seed type: {@code long[]}.</li>
+     *  <li>Native seed size: 2.</li>
+     * </ul>
+     */
+    PCG_XSH_RR_32(ProviderBuilder.RandomSourceInternal.PCG_XSH_RR_32),
+    /**
+     * Source of randomness is {@link org.apache.commons.rng.core.source32.PcgXshRs32}.
+     * <ul>
+     *  <li>Native seed type: {@code long[]}.</li>
+     *  <li>Native seed size: 2.</li>
+     * </ul>
+     */
+    PCG_XSH_RS_32(ProviderBuilder.RandomSourceInternal.PCG_XSH_RS_32),
+    /**
+     * Source of randomness is {@link org.apache.commons.rng.core.source64.PcgRxsMXs64}.
+     * <ul>
+     *  <li>Native seed type: {@code long[]}.</li>
+     *  <li>Native seed size: 2.</li>
+     * </ul>
+     */
+    PCG_RXS_M_XS_64(ProviderBuilder.RandomSourceInternal.PCG_RXS_M_XS_64),
+    /**
+     * Source of randomness is {@link org.apache.commons.rng.core.source32.PcgMcgXshRr32}.
+     * <ul>
+     *  <li>Native seed type: {@code Long}.</li>
+     *  <li>Native seed size: 1.</li>
+     * </ul>
+     */
+    PCG_MCG_XSH_RR_32(ProviderBuilder.RandomSourceInternal.PCG_MCG_XSH_RR_32),
+    /**
+     * Source of randomness is {@link org.apache.commons.rng.core.source32.PcgMcgXshRs32}.
+     * <ul>
+     *  <li>Native seed type: {@code Long}.</li>
+     *  <li>Native seed size: 1.</li>
+     * </ul>
+     */
+    PCG_MCG_XSH_RS_32(ProviderBuilder.RandomSourceInternal.PCG_MCG_XSH_RS_32);
 
     /** Internal identifier. */
     private final ProviderBuilder.RandomSourceInternal internalIdentifier;
diff --git a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/ProviderBuilder.java b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/ProviderBuilder.java
index 704c940..d0746d8 100644
--- a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/ProviderBuilder.java
+++ b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/internal/ProviderBuilder.java
@@ -37,6 +37,10 @@ import org.apache.commons.rng.core.source32.XoRoShiRo64Star;
 import org.apache.commons.rng.core.source32.XoRoShiRo64StarStar;
 import org.apache.commons.rng.core.source32.XoShiRo128Plus;
 import org.apache.commons.rng.core.source32.XoShiRo128StarStar;
+import org.apache.commons.rng.core.source32.PcgXshRr32;
+import org.apache.commons.rng.core.source32.PcgXshRs32;
+import org.apache.commons.rng.core.source32.PcgMcgXshRr32;
+import org.apache.commons.rng.core.source32.PcgMcgXshRs32;
 import org.apache.commons.rng.core.source64.SplitMix64;
 import org.apache.commons.rng.core.source64.XorShift1024Star;
 import org.apache.commons.rng.core.source64.XorShift1024StarPhi;
@@ -48,6 +52,7 @@ import org.apache.commons.rng.core.source64.XoShiRo256Plus;
 import org.apache.commons.rng.core.source64.XoShiRo256StarStar;
 import org.apache.commons.rng.core.source64.XoShiRo512Plus;
 import org.apache.commons.rng.core.source64.XoShiRo512StarStar;
+import org.apache.commons.rng.core.source64.PcgRxsMXs64;
 
 /**
  * RNG builder.
@@ -220,7 +225,27 @@ public final class ProviderBuilder {
         /** Source of randomness is {@link XoShiRo512StarStar}. */
         XO_SHI_RO_512_SS(XoShiRo512StarStar.class,
                          8,
-                         NativeSeedType.LONG_ARRAY);
+                         NativeSeedType.LONG_ARRAY),
+        /** Source of randomness is {@link PcgXshRr32}. */
+        PCG_XSH_RR_32(PcgXshRr32.class,
+                2,
+                NativeSeedType.LONG_ARRAY),
+        /** Source of randomness is {@link PcgXshRs32}. */
+        PCG_XSH_RS_32(PcgXshRs32.class,
+                2,
+                NativeSeedType.LONG_ARRAY),
+        /** Source of randomness is {@link PcgRxsMXs64}. */
+        PCG_RXS_M_XS_64(PcgRxsMXs64.class,
+                2,
+                NativeSeedType.LONG_ARRAY),
+        /** Source of randomness is {@link PcgMcgXshRr32}. */
+        PCG_MCG_XSH_RR_32(PcgMcgXshRr32.class,
+                1,
+                NativeSeedType.LONG),
+        /** Source of randomness is {@link PcgMcgXshRs32}. */
+        PCG_MCG_XSH_RS_32(PcgMcgXshRs32.class,
+                1,
+                NativeSeedType.LONG);
 
         /** Source type. */
         private final Class<? extends UniformRandomProvider> rng;
diff --git a/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersList.java b/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersList.java
index 381b672..8884b8e 100644
--- a/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersList.java
+++ b/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersList.java
@@ -56,6 +56,10 @@ public final class ProvidersList {
             add(LIST32, RandomSource.XO_RO_SHI_RO_64_SS, new int[] {78942, 134});
             add(LIST32, RandomSource.XO_SHI_RO_128_PLUS, new int[] {565642, 1234, 4534});
             add(LIST32, RandomSource.XO_SHI_RO_128_SS, new int[] {89, 1234, 6787});
+            add(LIST32, RandomSource.PCG_XSH_RR_32, new long[] {1738L, 1234L});
+            add(LIST32, RandomSource.PCG_XSH_RS_32, new long[] {259L, 2861L});
+            add(LIST32, RandomSource.PCG_MCG_XSH_RS_32, 9678L);
+            add(LIST32, RandomSource.PCG_MCG_XSH_RR_32, 2578291L);
             // ... add more here.
 
             // "long"-based RNGs.
@@ -71,6 +75,7 @@ public final class ProvidersList {
             add(LIST64, RandomSource.XO_SHI_RO_256_SS, new long[] {98765L, -2345678L, -3456789L});
             add(LIST64, RandomSource.XO_SHI_RO_512_PLUS, new long[] {89932L, -545669L, 4564689L});
             add(LIST64, RandomSource.XO_SHI_RO_512_SS, new long[] {123L, -654654L, 45646789L});
+            add(LIST64, RandomSource.PCG_RXS_M_XS_64, new long[] {42088L, 69271L});
             // ... add more here.
 
             // Do not modify the remaining statements.


[commons-rng] 02/02: RNG-84: Track changes.

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 3660516ed3f7467708ba10f34d929a77302370c5
Author: aherbert <ah...@apache.org>
AuthorDate: Tue Jul 30 13:42:41 2019 +0100

    RNG-84: Track changes.
    
    Closes #56
---
 src/changes/changes.xml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index f946ea5..da84511 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -75,6 +75,11 @@ re-run tests that fail, and pass the build if they succeed
 within the allotted number of reruns (the test will be marked
 as 'flaky' in the report).
 ">
+      <action dev="aherbert" type="add" issue="RNG-84" due-to="Abhishek Singh Dhadwal">
+        New Permuted Congruential Generators (PCG) from the PCG family.
+        Added the LCG and MCG 32 bit output versions of the XSH-RS and XSH-RR operations,
+        along with the 64 bit RXS-M-XS edition.
+      </action>
       <action dev="aherbert" type="add" issue="102">
         New "SharedStateSampler" interface to allow a sampler to create a new instance with
         a new source of randomness. Any pre-computed state can be shared between the samplers.