JuliaRandom / RandomNumbers.jl

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

Fix `seed!` for Xoshiro256 #82

Closed mtsch closed 3 years ago

mtsch commented 3 years ago

When seeding Xoshiro256 with an integer on 1.5, the following error is produced:

ERROR: MethodError: no method matching init_seed(::UInt64)
Closest candidates are:
  init_seed(::Any, ::Type{UInt64}) at /home/m/.julia/packages/RandomNumbers/jCCkY/src/Xorshifts/splitmix64.jl:50
  init_seed(::Any, ::Type{UInt64}, ::Int64) at /home/m/.julia/packages/RandomNumbers/jCCkY/src/Xorshifts/splitmix64.jl:51
  init_seed(::Any, ::Type{UInt32}, ::Int64) at /home/m/.julia/packages/RandomNumbers/jCCkY/src/Xorshifts/splitmix64.jl:58
Stacktrace:
 [1] seed!(r::RandomNumbers.Xorshifts.Xoshiro256StarStar, seed::Int64)
   @ RandomNumbers.Xorshifts ~/.julia/packages/RandomNumbers/jCCkY/src/Xorshifts/xoshiro256.jl:66
 [2] top-level scope
   @ REPL[13]:1

This PR fixes it by changing how init_seed is called in the seed! function.

sunoru commented 3 years ago

Thank you very much!!!

mtsch commented 3 years ago

Thanks for the quick merge! Could you maybe also tag a bugfix release? Our code depends on Xoshiro256StarStar and it's broken with RandomNumbers 1.5.

sunoru commented 3 years ago

Yes. I have already bumped a new version and registered v1.5.1 (See https://github.com/JuliaRegistries/General/pull/41931

mtsch commented 3 years ago

Thank you!