Cannot `convert` an object of type Random._GLOBAL_RNG to an object of type Random.MersenneTwister

I think something like the following should be a sensible definition: Base.convert(::Type{MersenneTwister}, rng::Random._GLOBAL_RNG) = copy(rng).

Random._GLOBAL_RNG is the type of GLOBAL_RNG, which is now kind of a “proxy” for the thread-local global RNG, which you get via default_rng() (before Julia 1.3, GLOBAL_RNG was an MersenneTwister). In the definition above, copy(rng) is specialized for rng == GLOBAL_RNG, and simply returns copy(default_rng()).

2 Likes