This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits 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 f5c2a905 RNG-200: JDKRandomBridge documents unsupported RandomSource 
instances
f5c2a905 is described below

commit f5c2a905c4b058774ffc20f55e451713d11d353f
Author: Alex Herbert <[email protected]>
AuthorDate: Sun Aug 23 16:08:35 2026 +0100

    RNG-200: JDKRandomBridge documents unsupported RandomSource instances
---
 .../main/java/org/apache/commons/rng/simple/JDKRandomBridge.java   | 7 +++++++
 .../java/org/apache/commons/rng/simple/JDKRandomBridgeTest.java    | 5 ++---
 src/changes/changes.xml                                            | 5 +++++
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git 
a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/JDKRandomBridge.java
 
b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/JDKRandomBridge.java
index 9f601081..81db391d 100644
--- 
a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/JDKRandomBridge.java
+++ 
b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/JDKRandomBridge.java
@@ -38,6 +38,10 @@ import 
org.apache.commons.rng.core.RandomProviderDefaultState;
  * In particular, there is no guarantee that the serialized form of this class
  * will be compatible across (even <em>minor</em>) releases of the library.</p>
  *
+ * <p>Note: This class does not support any {@link RandomSource} that requires
+ * constructor arguments in addition to the seed
+ * (see {@link RandomSource#create(Object, Object...)}).</p>
+ *
  * @since 1.0
  */
 public final class JDKRandomBridge extends Random {
@@ -64,6 +68,9 @@ public final class JDKRandomBridge extends Random {
      *
      * @param source Source of randomness.
      * @param seed Seed.  Can be {@code null}.
+     * @throws IllegalArgumentException if the {@code source} requires 
constructor
+     * arguments in addition to the {@code seed}.
+     * @see RandomSource#create(Object, Object...)
      */
     public JDKRandomBridge(RandomSource source,
                            Object seed) {
diff --git 
a/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/JDKRandomBridgeTest.java
 
b/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/JDKRandomBridgeTest.java
index 1bb09fd2..3fbc5878 100644
--- 
a/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/JDKRandomBridgeTest.java
+++ 
b/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/JDKRandomBridgeTest.java
@@ -56,9 +56,8 @@ class JDKRandomBridgeTest {
      * Test serialization with all sources. This ensures the maximum state 
size limit
      * is suitable for all implementations in the library.
      *
-     * <p>Excludes TWO_CMRES_SELECT which is does not currently save the 
subcycle generator
-     * instance in the state. The save/restore functionality is meant to 
operate on the same
-     * instance of the generator where the subcycle generators are already 
known.
+     * <p>Excludes TWO_CMRES_SELECT which requires additional constructor 
arguments and is
+     * not supported.
      */
     @ParameterizedTest
     @EnumSource(value = RandomSource.class, mode = Mode.EXCLUDE, names = 
{"TWO_CMRES_SELECT"})
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 5dbbcd17..62ce5b07 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -56,6 +56,11 @@ If the output is not quite correct, check for invisible 
trailing spaces!
     <release version="1.8" date="TBD" description="
 New features, updates and bug fixes (requires Java 8).
 ">
+      <action dev="aherbert" type="update" due-to="Alex Herbert" 
issue="RNG-200">
+        "JDKRandomBridge": Document lack of support for RandomSource instances
+        that require constructor arguments in addition to the seed. This
+        currently excludes TWO_CMRES_SELECT from use in the bridge.
+      </action>
       <action dev="aherbert" type="update" due-to="Security scan, Alex 
Herbert" issue="RNG-199">
         "JDKRandomBridge": Validate state size before byte allocation during
         deserialization. Avoids negative array size and fails fast for an 
obviously

Reply via email to