This can be tricky. When I did this in dsd, it wasn't sufficient to use the same RNG everywhere. I discovered through much trial and error that I was getting different results on different runs because Python does not guarantee iteration order of set's, i.e., if you make the same set by putting in items in the same order twice, and iterate over them, you might iterate in a different order each time. That's why dsd uses the ordered-set package and only uses OrderedSet when it could affect the run results.
Luckily, Python dict's do guarantee iteration order.
There is a seed option, so in theory it should be reproducible.
I haven't tested this thoroughly, so the TODO here is to add some unit tests of reproducibility.
This can be tricky. When I did this in dsd, it wasn't sufficient to use the same RNG everywhere. I discovered through much trial and error that I was getting different results on different runs because Python does not guarantee iteration order of
set
's, i.e., if you make the same set by putting in items in the same order twice, and iterate over them, you might iterate in a different order each time. That's why dsd uses the ordered-set package and only usesOrderedSet
when it could affect the run results.Luckily, Python
dict
's do guarantee iteration order.