Add comments from reference impl of xoroshiro128+
This commit is contained in:
parent
97bc26ce7f
commit
d40174327e
|
@ -27,6 +27,46 @@
|
||||||
namespace { // anonymous namespace
|
namespace { // anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pseudo random number generator "xoroshiro128+"
|
||||||
|
*
|
||||||
|
* This code is based on the reference implementation,
|
||||||
|
* modified by Joris van Rantwijk to fit in a C++ class.
|
||||||
|
*
|
||||||
|
* Source: http://prng.di.unimi.it/
|
||||||
|
*
|
||||||
|
* The following commpents apply to the reference implementation:
|
||||||
|
*
|
||||||
|
* Written in 2016-2018 by David Blackman and Sebastiano Vigna (vigna@acm.org)
|
||||||
|
*
|
||||||
|
* To the extent possible under law, the author has dedicated all copyright
|
||||||
|
* and related and neighboring rights to this software to the public domain
|
||||||
|
* worldwide. This software is distributed without any warranty.
|
||||||
|
*
|
||||||
|
* See <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||||
|
*
|
||||||
|
* This is xoroshiro128+ 1.0, our best and fastest small-state generator
|
||||||
|
* for floating-point numbers. We suggest to use its upper bits for
|
||||||
|
* floating-point generation, as it is slightly faster than
|
||||||
|
* xoroshiro128++/xoroshiro128**. It passes all tests we are aware of
|
||||||
|
* except for the four lower bits, which might fail linearity tests (and
|
||||||
|
* just those), so if low linear complexity is not considered an issue (as
|
||||||
|
* it is usually the case) it can be used to generate 64-bit outputs, too;
|
||||||
|
* moreover, this generator has a very mild Hamming-weight dependency
|
||||||
|
* making our test (http://prng.di.unimi.it/hwd.php) fail after 5 TB of
|
||||||
|
* output; we believe this slight bias cannot affect any application. If
|
||||||
|
* you are concerned, use xoroshiro128++, xoroshiro128** or xoshiro256+.
|
||||||
|
*
|
||||||
|
* We suggest to use a sign test to extract a random Boolean value, and
|
||||||
|
* right shifts to extract subsets of bits.
|
||||||
|
*
|
||||||
|
* The state must be seeded so that it is not everywhere zero. If you have
|
||||||
|
* a 64-bit seed, we suggest to seed a splitmix64 generator and use its
|
||||||
|
* output to fill s.
|
||||||
|
*
|
||||||
|
* NOTE: the parameters (a=24, b=16, b=37) of this version give slightly
|
||||||
|
* better results in our test than the 2016 version (a=55, b=14, c=36).
|
||||||
|
*/
|
||||||
class Xoroshiro128plus
|
class Xoroshiro128plus
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue