[
https://issues.apache.org/jira/browse/RNG-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16796208#comment-16796208
]
Alex D Herbert commented on RNG-82:
-----------------------------------
The new {{XorShift1024StarPhi}} is a simple variant of the original
{{XorShift1024Star}}. The internal state is maintained identically. The final
output is a long multiplied by a factor. Only the factor is different between
the two algorithms.
An experiment was performed to determine if the output from the two generators
with the same seed was correlated.
XorComposite: A composite of two rngs using the xor operation:
{code:java}
return new IntProvider() {
@Override
public int next() {
return rng1.nextInt() ^ rng2.nextInt();
}
};
{code}
SerialComposite: A composite of two rngs using alternating output:
{code:java}
return new IntProvider() {
private int flip;
@Override
public int next() {
return ((flip++ & 1) == 0) ? rng1.nextInt() : rng2.nextInt();
}
};
{code}
Tests were performed using:
||Name||rng1||rng2||Method||Notes||
|XorShiftXorComposite|XorShift1024Star|XorShift1024StarPhi|XorComposite|Same
seed|
|XorShiftSerialComposite|XorShift1024Star|XorShift1024StarPhi|SerialComposite|Same
seed|
|SplitXorComposite|XorShift1024Star|TwoCmres|XorComposite|Control|
The same seed was used for variants of the {{XorShift1024}} algorithm to ensure
the internal state of each was synchronised.
The final composite is a control to show that two unrelated generators can be
effectively combined.
The composites were run through the test suites of *DieHarder* and *BigCrush*
and failures counted:
||Name||DieHarder||BigCrush||
|XorShiftXorComposite|57, 57, 57|54, 53, 53|
|XorShiftSerialComposite|13, 15, 10|40, 39, 39|
|SplitXorComposite|0, 0, 0|0, 0, 0|
Note: DieHarder has 96 tests, BigCrush has 160.
*Conclusion*
The test suites indicate that the two variants of the method are correlated.
This indicates that the current {{XOR_SHIFT_1024_S}} enum should be deprecated
in favour of {{XOR_SHIFT_1024_S_PHI}}.
> XorShift1024StarPhi generator
> -----------------------------
>
> Key: RNG-82
> URL: https://issues.apache.org/jira/browse/RNG-82
> Project: Commons RNG
> Issue Type: New Feature
> Components: core, simple
> Affects Versions: 1.3
> Reporter: Alex D Herbert
> Assignee: Alex D Herbert
> Priority: Major
> Fix For: 1.3
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The authors of the algorithm implemented in
> {{org.apache.commons.rng.core.source64.XorShift1024Star}} have produced a new
> variant using a different multiplier. The source code is described here:
> [xorshift1024star.c|http://xorshift.di.unimi.it/xorshift1024star.c]
> For clarity the code states:
> {noformat}
> NOTE: as of 2017-10-08, this generator has a different multiplier (a
> fixed-point representation of the golden ratio), which eliminates
> linear dependencies from one of the lowest bits. The previous
> multiplier was 1181783497276652981 (M_8 in the paper). If you need to
> tell apart the two generators, you can refer to this generator as
> xorshift1024φ and to the previous one as xorshift1024*M_8.
> {noformat}
> This can be added as a variant of the current implementation:
> class = XorShift1024StarPhi
> RandomSource = XOR_SHIFT_1024_S_PHI
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)