Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default seed for a System is generated from the task-local RNG #334

Merged
merged 9 commits into from
Nov 16, 2024
Merged

Conversation

kbarros
Copy link
Member

@kbarros kbarros commented Nov 15, 2024

The default System random number seed is now seed=rand(UInt). The motivation is that calling Random.seed! prior to System construction will fix System.rng in a deterministic way. This may be helpful for writing reproducible Sunny scripts that sometimes also call Julia's task-local RNG.

An underlying motivation is to make the doc builds exactly reproducible. This will hopefully allow for more compression on the gh-pages branch, which already requires 160+ MB to store docs images, with repetition on every Sunny release. See also #233 (comment).

@kbarros kbarros requested a review from ddahlbom November 15, 2024 18:36
Copy link
Member

@ddahlbom ddahlbom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good change. Thanks, Kip.

@@ -37,6 +37,7 @@ function build_examples(example_sources, destdir)
"""
# Download this example as [Julia file]($assetsdir/scripts/$name.jl) or [Jupyter notebook]($assetsdir/notebooks/$name.ipynb).

import Random; Random.seed!(0); #hide
""" * str
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@kbarros kbarros merged commit c812245 into main Nov 16, 2024
4 checks passed
@kbarros kbarros deleted the seed branch November 16, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants