Stop reseeding RNG on every solve call (fixes #464) #539
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the change requested in #464 - stopping the automatic reseeding of the RNG on every call to
solve.Problem
Previously, JumpProcesses would reseed the RNG with
rand(UInt64)on every call tosolvewhen:seed === nothing(no explicit seed provided)alias_jump == false(i.e., when not on the main thread, or when deepcopying the problem)This led to non-reproducible results because it didn't respect the user's RNG choice.
Solution
resetted_jump_probleminsrc/solve.jlto only reseed when an explicit seed is providedDiffEqBase.__initinsrc/SSA_stepper.jlsimilarlytest/ensemble_uniqueness.jlto useprob_funcwith explicit seeds for each trajectoryBreaking Change
This is a breaking change as noted in #464. For
EnsembleProblems that require different trajectories, users should now useprob_functo set unique seeds for each trajectory. This gives users full control over reproducibility.Example of the new pattern for EnsembleProblems:
Test plan
test/ensemble_uniqueness.jlto demonstrate the new patternFixes #464
cc @ChrisRackauckas
🤖 Generated with Claude Code