SciML / SciML/DiffEqNoiseProcess.jl

Using TaskLocalRNG results in identical noise across processes

Open
#258 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Julia
Stars
62
Forks
32
Avg merge
8h 38m
Merged PRs (30d)
16

Description

When multiple noise processes are created sequentially with the default TaskLocalRNG or a user passed TaskLocalRNG and no intervening rand calls, copy(rng) gives each process an identical RNG state, resulting in statistically identical samples.

using DiffEqBase, DiffEqNoiseProcess

# Create two WienerProcesses back-to-back with default RNG
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)

println("W1 samples: ", sol1.W)
println("W2 samples: ", sol2.W)
println("Identical?  ", sol1.W == sol2.W)

Output (v5.27.0): Identical? true — both processes produce the exact same noise samples.

This is due to the changes made in https://github.com/SciML/DiffEqNoiseProcess.jl/commit/c305243aa484cd4e7946e6ccf301852bc6e418b7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WienerProcess constructors and the TaskLocalRNG path described in the reproduction, then trace how copy(rng) is used when processes are created back-to-back. Re-run the provided NoiseProblem example and confirm that sequential processes no longer produce identical samples.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.