Skip to content

Commit d98ba71

Browse files
committed
Make split() deterministic across architectures
1 parent 6c2cee3 commit d98ba71

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "AdvancedPS"
22
uuid = "576499cb-2369-40b2-a588-c64705576edc"
33
authors = ["TuringLang"]
4-
version = "0.6"
4+
version = "0.6.1"
55

66
[deps]
77
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"

src/rng.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ Base.rand(rng::TracedRNG, ::Type{T}) where {T} = Base.rand(rng.rng, T)
3636
Split `key` into `n` new keys
3737
"""
3838
function split(key::Integer, n::Integer=1)
39-
T = typeof(key) # Make sure the type of `key` is consistent on W32 and W64 systems.
40-
return T[hash(key, i) for i in UInt(1):UInt(n)]
39+
T = typeof(key)
40+
inner_rng = Random.MersenneTwister(key)
41+
return rand(inner_rng, T, n)
4142
end
4243

4344
"""

0 commit comments

Comments
 (0)