[
https://issues.apache.org/jira/browse/RNG-200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alex Herbert resolved RNG-200.
------------------------------
Fix Version/s: 1.8
Assignee: Alex Herbert
Resolution: Implemented
Note: There is no requirement to throw an exception if TWO_CMRES_SELECT is used
in the JDKRandomBridge. This already raises an IllegalArgumentException in the
constructor when an instance of the RandomSource cannot be created due to lack
of additional constructor arguments.
The solution is to accept the current behaviour and document lack of support
for RandomSource instances that require additional constructor arguments. This
is a documentation change only as no code was modified.
Changes made in commit:
f5c2a905c4b058774ffc20f55e451713d11d353f
> TWO_CMRES_SELECT cannot be serialized within JDKRandomBridge
> ------------------------------------------------------------
>
> Key: RNG-200
> URL: https://issues.apache.org/jira/browse/RNG-200
> Project: Commons RNG
> Issue Type: Bug
> Components: simple
> Affects Versions: 1.7
> Reporter: Alex Herbert
> Assignee: Alex Herbert
> Priority: Minor
> Fix For: 1.8
>
>
> The TWO_CMRES_SELECT random source is constructed using a seed and two chosen
> sub-cycle generators. The state of the RNG can be saved and restored using
> the methods of RestorableUniformRandomProvider. This state *does not* include
> the identifiers of the sub-cycle generators. Thus the state can be restored
> to the *same instance* of the RNG where the sub-cycle generators are known.
> It cannot be used to create a new instance of the generator when
> deserializing the state in the JDKRandomBridge.
> The JDKRandomBridge creates a new instance of the random source using:
> {code:java}
> delegate = source.create(); {code}
> This is the no argument factory method of RandomSource:
> {code:java}
> public RestorableUniformRandomProvider create() {code}
> The TWO_CMRES_SELECT generator requires the two sub cycle generators to be
> specified in the overloaded factory method:
> {code:java}
> public RestorableUniformRandomProvider create(Object seed,
> Object... data) {code}
> For example:
> {code:java}
> long seed = 1;
> int subCycle1 = 3;
> int subCycle2 = 8;
> delegate = source.create(seed, subCycle1, subCycle2); {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)