From 48c122d68de52d805d32311d4e8f5b2a491477c7 Mon Sep 17 00:00:00 2001 From: Rafael Fourquet Date: Sat, 2 May 2020 21:41:26 +0200 Subject: [PATCH] fix ambiguity for range generation in Julia 1.5 (#2) Cf. https://github.com/JuliaLang/julia/pull/29240. --- src/StableRNGs.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/StableRNGs.jl b/src/StableRNGs.jl index 3970aa9..1d603c9 100644 --- a/src/StableRNGs.jl +++ b/src/StableRNGs.jl @@ -88,9 +88,11 @@ function rand(rng::LehmerRNG, sp::SamplerRangeFast{UInt128,T}) where T x % T + a end -Sampler(::Type{LehmerRNG}, r::AbstractUnitRange{T}, ::Random.Repetition - ) where {T<:BitInteger} = - SamplerRangeFast(r) +for T in Base.BitInteger_types + # eval because of ambiguities with `where T <: BitInteger` + @eval Sampler(::Type{LehmerRNG}, r::AbstractUnitRange{$T}, ::Random.Repetition) = + SamplerRangeFast(r) +end end # module