Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 0 additions & 4 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ function NoiseProcess{iip}(
reset = true, reseed = true, continuous = true,
cache = nothing
) where {iip}
rng = rng isa Random.TaskLocalRNG ? copy(rng) : rng
S₁ = ResettableStacks.ResettableStack{iip}(
Tuple{
typeof(t0), typeof(W0), typeof(Z0),
Expand Down Expand Up @@ -396,7 +395,6 @@ mutable struct SimpleNoiseProcess{
rng = Random.default_rng(),
reset = true, reseed = true
) where {iip}
rng = rng isa Random.TaskLocalRNG ? copy(rng) : rng
if Z0 == nothing
Z = nothing
curZ = nothing
Expand Down Expand Up @@ -836,7 +834,6 @@ mutable struct NoiseTransport{T, N, wType, zType, Tt, T2, T3, TRV, Trv, RNGType,
reset = true, reseed = true,
noise_prototype = W(nothing, nothing, t0, rv)
) where {iip}
rng = rng isa Random.TaskLocalRNG ? copy(rng) : rng
curt = t0
dt = t0
curW = copy(noise_prototype)
Expand Down Expand Up @@ -1389,7 +1386,6 @@ function BoxWedgeTail{iip}(
rng = Random.default_rng(),
reset = true, reseed = true
) where {iip}
rng = rng isa Random.TaskLocalRNG ? copy(rng) : rng
if Z0 === nothing
Z = nothing
curZ = nothing
Expand Down
16 changes: 16 additions & 0 deletions test/two_processes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,19 @@ Random.seed!(seed);
@test norm(soloop.Z - sol.Z) == 0.0
end
end

@testset "Default RNG produces independent noise processes" begin
# reseed = false so that solve doesn't re-randomize the RNG,
# ensuring we test that construction-time RNG states differ.
W1 = WienerProcess(0.0, 0.0, 0.0; reseed = false)
W2 = WienerProcess(0.0, 0.0, 0.0; reseed = false)
sol1 = solve(NoiseProblem(W1, (0.0, 1.0)); dt = 0.1)
sol2 = solve(NoiseProblem(W2, (0.0, 1.0)); dt = 0.1)
@test sol1.W != sol2.W

W1! = WienerProcess!(0.0, zeros(3), zeros(3); reseed = false)
W2! = WienerProcess!(0.0, zeros(3), zeros(3); reseed = false)
sol1! = solve(NoiseProblem(W1!, (0.0, 1.0)); dt = 0.1)
sol2! = solve(NoiseProblem(W2!, (0.0, 1.0)); dt = 0.1)
@test sol1!.W != sol2!.W
end
Loading