Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions stdlib/Random/src/RNGs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,26 @@ function show(io::IO, rng::MersenneTwister)
end
print(io, MersenneTwister, "(", repr(rng.seed), ", (")
# state
adv = Integer[rng.adv_jump, rng.adv]
sep = ", "
show(io, rng.adv_jump)
print(io, sep)
show(io, rng.adv)
if rng.adv_vals != -1 || rng.adv_ints != -1
if rng.adv_vals == -1
@assert rng.idxF == MT_CACHE_F
push!(adv, 0, 0) # "(0, 0)" is nicer on the eyes than (-1, 1002)
else
push!(adv, rng.adv_vals, rng.idxF)
end
# "(0, 0)" is nicer on the eyes than (-1, 1002)
s = rng.adv_vals != -1
print(io, sep)
show(io, s ? rng.adv_vals : zero(rng.adv_vals))
print(io, sep)
show(io, s ? rng.idxF : zero(rng.idxF))
end
if rng.adv_ints != -1
idxI = (length(rng.ints)*16 - rng.idxI) / 8 # 8 represents one Int64
idxI = Int(idxI) # idxI should always be an integer when using public APIs
push!(adv, rng.adv_ints, idxI)
print(io, sep)
show(io, rng.adv_ints)
print(io, sep)
show(io, idxI)
end
join(io, adv, ", ")
print(io, "))")
end

Expand Down