JuliaRandom / StableRNGs.jl

A Julia RNG with stable streams
MIT License
57 stars 6 forks source link

Method ambiguity of `shuffle!(::StableRNG, ::AbstractArray{Bool})` on Julia 1.11 #23

Closed devmotion closed 5 months ago

devmotion commented 5 months ago
julia> using StableRNGs, Random

julia> shuffle!(StableRNG(123), [false, true, false])
ERROR: MethodError: shuffle!(::StableRNGs.LehmerRNG, ::Vector{Bool}) is ambiguous.

Candidates:
  shuffle!(r::StableRNGs.LehmerRNG, a::AbstractArray)
    @ StableRNGs ~/.julia/dev/StableRNGs/src/StableRNGs.jl:144
  shuffle!(r::AbstractRNG, a::AbstractArray{Bool})
    @ Random ~/.asdf/installs/julia/1.11.0-beta1/share/julia/stdlib/v1.11/Random/src/misc.jl:223

Possible fix, define
  shuffle!(::StableRNGs.LehmerRNG, ::AbstractArray{Bool})

julia> versioninfo()
Julia Version 1.11.0-beta1
Commit 08e1fc0abb9 (2024-04-10 08:40 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 10 × Apple M2 Pro
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m2)
Threads: 1 default, 0 interactive, 1 GC (on 6 virtual cores)
Environment:
  JULIA_PKG_USE_CLI_GIT = true

The issue seems to be caused by https://github.com/JuliaLang/julia/pull/52133