Skip to content

Commit 75c4f55

Browse files
authored
show(::MersenneTwister) : use module qualification (#40583)
show(::MersenneTwister) : use module qualification Instead of always printing `MersenneTwister(...)`, we also prepend `Random.` when not is scope, e.g. ```julia julia> import Random; Random.MersenneTwister(0) Random.MersenneTwister(0) ```
1 parent a4e1082 commit 75c4f55

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/Random/src/RNGs.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ function show(io::IO, rng::MersenneTwister)
181181
seed = from_seed(rng.seed)
182182
seed_str = seed <= typemax(Int) ? string(seed) : "0x" * string(seed, base=16) # DWIM
183183
if rng.adv_jump == 0 && rng.adv == 0
184-
return print(io, "MersenneTwister($seed_str)")
184+
return print(io, MersenneTwister, "(", seed_str, ")")
185185
end
186-
print(io, "MersenneTwister($seed_str, (")
186+
print(io, MersenneTwister, "(", seed_str, ", (")
187187
# state
188188
adv = Integer[rng.adv_jump, rng.adv]
189189
if rng.adv_vals != -1 || rng.adv_ints != -1

0 commit comments

Comments
 (0)