Following my earlier list posting
<http://forum.dlang.org/post/kdobdorqztlsomwef...@forum.dlang.org>, I'm pleased to announce an initial release of a dub package providing some of the RNGs from the extended family of xorshift-inspired generators. These should complement the existing xorshift implementations already provided to Phobos' std.random by Masahiro Nakagawa: they are fast, high-quality generators representing some of the state of the art in pseudo-RNG design.
The generators implemented have been ported from public-domain
reference implementations available here:
http://xoroshiro.di.unimi.it/ Following the original authors'
example, these D ports have also been dedicated to the public
domain using the Creative Commons CC0 license.
At this stage, only a direct port has been provided, with no
attempts at generics (e.g. on the unsigned integer type used, or
the magic constants used in the RNG update methods). The
provided generators are:
* SplitMix64: a fast generator with only 64 bits
of state; this is probably inadequate for any
serious statistical work, but is provided as a
convenient means of generating seeds for other
more heavy-duty algorithms
* xoroshiro128+: a very fast and high quality
generator with 128 bits of state; this ought
to be a great generator for anyone not doing
massively parallel simulations
* xorshift1024*: a very fast and high quality
generator with 1024 bits of state; this is
slower than xoroshiro128+, but can be used
with much larger-scale parallel simulations
The xoroshiro128+ and xorshift1024* generators come with `jump()`
methods, the equivalent of 2 ^^ 64 and 2 ^^ 512 calls to
`popFront()` respectively, which can be used to generate the
starting points for (again respectively) 2 ^^ 64 or 2 ^^ 512
independent sequences of variates.
The generators are all implemented as structs, but in order to
prevent some known problems with unintended copy-by-value of
RNGs, the postblit has been disabled. For similar reasons, these
generators are implemented as input ranges, not forward ranges,
so that library functionality cannot copy generator state under
`dup` properties are however provided for all generators, to
allow the programmer to deliberately copy RNG state.
Testing, feedback and general usage are all welcome. I am
planning on submitting these to Phobos (although sorting out the
generic side of things might be a good idea first).