[
https://issues.apache.org/jira/browse/RNG-200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18107081#comment-18107081
]
Gilles Sadowski commented on RNG-200:
-------------------------------------
As noted in the
[Javadoc|https://commons.apache.org/proper/commons-rng/commons-rng-simple/apidocs/org/apache/commons/rng/simple/JDKRandomBridge.html],
{{JDKRandomBridge}} was only meant to allow "legacy" applications to access a
PRNG with better qualities (randomness, speed) than {{java.util.Random}}.
There was/is plenty of choice apart from {{TWO_CMRES_SELECT}}; so sure, I agree
with your proposal.
FTR, I ported this algorithm in the early days of "RNG" because it was the
first (IIRC) that used a {{long}} as "source of randomness" (as proof that this
would be faster than all the other PRNGs implemented at the time in "Commons
Math").
By the way, in the
[Javadoc|https://commons.apache.org/proper/commons-rng/commons-rng-core/apidocs/org/apache/commons/rng/core/source64/TwoCmres.html]
of {{TwoCmres}} class, the links to the articles that described the algorithm
are now dead.
> 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: core, simple
> Affects Versions: 1.7
> Reporter: Alex Herbert
> Priority: Minor
>
> 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)