Hello.
Le jeu. 7 mars 2019 à 00:44, Alex Herbert <alex.d.herbert@gmail.com> a écrit :
>
>
>
> > On 6 Mar 2019, at 22:57, Gilles Sadowski <gilleseran@gmail.com> wrote:
> >
> >>>
> >>> However I will test if XorShift1024Star and XorShift1024StarPhi are correlated
just for completeness.
> >>>
> >>
> >> Did a test of 100 repeats of a correlation of 50 longs from the XorShift1024Star
and XorShift1024StarPhi, new seed each time:
> >>
> >> SummaryStatistics:
> >> n: 100
> >> min: 0.30893547071559685
> >> max: 0.37616626218398586
> >> sum: 3.300079237520435
> >> mean: 0.033000792375204355
> >> geometric mean: NaN
> >> variance: 0.022258533475114764
> >> population variance: 0.022035948140363616
> >> second moment: 2.2035948140363617
> >> sum of squares: 2.312500043775496
> >> standard deviation: 0.14919294043323486
> >> sum of logs: NaN
> >>
> >> Note that the algorithm is the same except the final step when the multiplier
is used to scale the final output long:
> >>
> >> return state[index] * multiplier;
> >>
> >> So if it was outputting a double the correlation would be 1. But it is a long
generator so the long arithmetic wraps to negative on large multiplications. The result is
that the mean correlation is close to 0.
> >>
> >> A single repeat using 1,000,000 numbers has a correlation of 0.002.
> >>
> >> Am I missing something here with this type of test?
> >
> > I'm afraid I don't follow: If the state is the same then I'd assume that
> > the two generators are the same (i.e. totally correlated).
> >
>
> The state is totally correlated (it is identical). The output sequence is not due to
wrapping in long arithmetic. Here’s a mock example:
>
> positive number * medium positive number = big positive number (close to Long.MAX_VALUE)
>
> Vs
>
> positive number * bigger positive number = negative number (due to wrapping)
>
> So by changing the multiplier this wrapping causes the output bits to be different. This
is why the new variant "eliminates linear dependencies from one of the lowest bits” (quoted
from the authors c code).
>
> The multiplier was changed from 1181783497276652981L to 0x9e3779b97f4a7c13L. These numbers
are big:
>
> Long.MAX_VALUE / 1181783497276652981L = 7.8046207770792755
> Long.MAX_VALUE / 0x9e3779b97f4a7c13L = 1.3090169943749475
>
> Big enough such that wrapping will occur on every multiplication unless the positive
number is <8, or now <2. So basically all the time.
>
> So, IIUC, the output is thus a truncated product formed by the wrapping long arithmetic
and not correlated.
>
I wonder: Would that mean that any choice of a "big" number creates a new RNG?
IOW, if we create a composite one from such generators (i.e. pick one
number from
each in order to compose the composite source), will it be as good as
any of them
on the stress test suites?
Gilles

To unsubscribe, email: devunsubscribe@commons.apache.org
For additional commands, email: devhelp@commons.apache.org
