Skip to content

Commit

Permalink
show(::MersenneTwister) : use module qualification (#40583)
Browse files Browse the repository at this point in the history
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)
```
  • Loading branch information
rfourquet committed Apr 26, 2021
1 parent a4e1082 commit 75c4f55
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stdlib/Random/src/RNGs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ function show(io::IO, rng::MersenneTwister)
seed = from_seed(rng.seed)
seed_str = seed <= typemax(Int) ? string(seed) : "0x" * string(seed, base=16) # DWIM
if rng.adv_jump == 0 && rng.adv == 0
return print(io, "MersenneTwister($seed_str)")
return print(io, MersenneTwister, "(", seed_str, ")")
end
print(io, "MersenneTwister($seed_str, (")
print(io, MersenneTwister, "(", seed_str, ", (")
# state
adv = Integer[rng.adv_jump, rng.adv]
if rng.adv_vals != -1 || rng.adv_ints != -1
Expand Down

2 comments on commit 75c4f55

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt

Please sign in to comment.