JuliaRandom / RandomNumbers.jl

Random Number Generators for the Julia Language.
https://juliarandom.github.io/RandomNumbers.jl/stable
Other
97 stars 23 forks source link

Please consider implementing xoshiro256** (and/or xoshiro256+) #52

Open PallHaraldsson opened 5 years ago

PallHaraldsson commented 5 years ago

https://nullprogram.com/blog/2017/09/21/ "xoroshiro128+ fails PractRand very badly. [..] Since this article was published, its authors have supplanted it with xoshiro256. It has essentially the same performance, but better statistical properties. xoshiro256 is now my preferred PRNG"

See also my https://github.com/JuliaLang/julia/issues/27614#issuecomment-454749117 for others to possibly implement (mostly Google's Randen based on AES, the one I list here would however be my first choice) and updated top comment there.

PallHaraldsson commented 5 years ago

I guess it would be best to implement here first; I believed we already had the best option here, thanks to you, but anyway if we had chosen, or when, could we just have copied yours to Julia's Random stdlib?

I believe legally we could (even same license). I'm not sure there's some protocol to follow. I could make a PR copying code from your package. I however do not want to take credit from you or anyone.

sunoru commented 5 years ago

I finally have time to read the interesting article and this issue. Thank you for the suggestion!

I have implemented xoshiro256** and xoshiro256+, as well as the other recommended PRNGs in their page (see https://github.com/sunoru/RandomNumbers.jl/commit/c91f9481f9f11af2ed08bf1347f4d0b379e7f049). Some deprecation warnings are also made in the code. However the docs and benchmarks may also need to be updated, and the recommended seeding function (SplitMix64) is also not fully applied yet. And it's true that BigCrush of TestU01 may not be the best choice anymore since DieHarder looks very good. Are you interested to help play around and do some test?

It is totally OK to copy this code into Random stdlib, and it's also what I wanted.

PallHaraldsson commented 5 years ago

It seems this issue can be closed, since you implemented, thanks!

It is totally OK to copy this code into Random stdlib, and it's also what I wanted.

We've missed the 1.2 feature freeze, but I may do this, or anyone can, and closing this issue will signal the possibility of doing that at the linked Julialang issue.

PallHaraldsson commented 5 years ago

Thanks again, FYI I just heard of Threefry supposedly fastest, and see also in comment above mine what NumPy adopted:

https://github.com/JuliaLang/julia/issues/27614#issuecomment-521371329

EDIT: SFC64 is faster than what NumPy choose, not sure how Threefry or other compare.

Looking for implementations I found: https://sourceforge.net/p/pracrand/discussion/366935/thread/a7761577/ "I'm parallelizing SFC generators and trying to avoid correlation."

[and: https://github.com/maxmind/gatling-gen/blob/master/ext/PracRand/include/PractRand/RNGs/sfc64.h that doesn't seem helpful]