The original typo derives directly from George Marsaglia's paper
introducing the Xorshift RNGs. The original checking values, derived
from that code, thus also reflect the typo.
A corrected version of the reference code is available from
https://github.com/WebDrake/xorshift/ and has been used to
generate the updated checking values.
The original typo derives directly from George Marsaglia's paper
introducing the Xorshift RNGs. The original checking values, derived
from that code, thus also reflect the typo.
A corrected version of the reference code is available from
https://github.com/WebDrake/xorshift/ and has been used to
generate the updated checking values.
don't work with Xorshift.
This is an instance of Issue 2803, a clash between a template
parameter and a default argument. I've used the workaround
proposed in that issue thread:
http://d.puremagic.com/issues/show_bug.cgi?id=2803#c1
Tests have been included to ensure that these functions work
with all possible RNG types.
Unittests for LinearCongruentialEngine were previously missing the
constructor and the .save and .opEquals() methods.
Code coverage analysis still fails to pick up on the static methods
and the contents of a static if scope in lines 374-382 of .popFront().
The old unittests were missing coverage of large sections of
RandomSample.skip() because the ratios of sample size to source size
were such that Algorithm A was always being chosen over Algorithm D.
The new unittests fix this and also extend coverage to a number of
other areas previously not addressed. There are also currently-failing
tests commented out with version(none) that can be used to verify
future bugfixes and improvements.
A few lines in skip() remain uncovered simply because they depend on
runtime conditions that are extremely rare.
This small tweak has been accompanied by a couple of extra checks
to ensure that users do not request more sample points than are
available in the input, which could otherwise be the source of
exceptions.
There exists one remaining case where RandomSample may fail: if it
is given an InputRange without the .length property, and the user
indicates that the total number of items available is greater
than what the InputRange actually contains. In this case an
exception is thrown from std.array.popFront() line 450,
"Attempting to popFront() past the end of an array", or from
std.array.front() line 624, "Attempting to fetch the front of an
empty array."