-
Notifications
You must be signed in to change notification settings - Fork 1
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
State of Random Number Generator Changes after plotting trj #19
Comments
Certainly, but this is not set.seed(123)
head(.Random.seed)
#> [1] 10403 624 -983674937 643431772 1162448557 -959247990
DiagrammeR::create_graph()
#> DiagrammeR Graph // no nodes
#> ...
head(.Random.seed)
#> [1] 10403 16 515190382 2133433928 917665867 1283494313 Could you please report it there? |
Thank you very much for a very prompt reply. Now I see why. But I still think simmer.plot could do something about it, since users of simmer for DES are likely to concern about reproducibility, while general users of DiagrammeR may not. It took me a long time to figure out why the seemingly same programs with same initial seed produced different results. I assume that as simmer becomes more and more popular, there will be more future users stumbling over this since they would not anticipate the change of RNG state using the overloaded plot function. Currently, what I do for my code is to store the RNG state before trj plot, and restore it after the plot. I think it would be more natural to do it within simmer.plot. Just my suggestion, and I don't want to sound ungrateful. In fact, simmer is very valuable, and I appreciate your time and efforts. Again, thanks very much for developing and maintaining these wonderful tools for DES. |
Ok, I'll keep this open for now, and I might apply a patch if upstream is not responding, but ideally this should be fixed in DiagrammeR. I don't think it's reasonable to change the RNG state when creating a non-random graph. Upstream issue for reference: rich-iannone/DiagrammeR#358. |
I came across this issue because my program generated different outputs if I plot trajectory after setting random seed. I believe that most users (or is it just me?) would not expect a change of state of random number generator after a trajectory plot, since there is no simulation conducted yet. Here is a minimal example
The output of
head(oldseed)
isThe output of
head(newseed)
isThe text was updated successfully, but these errors were encountered: