april-tools / cirkit

a python framework to build, learn and reason about probabilistic circuits and tensor networks
https://cirkit-docs.readthedocs.io/en/latest/
GNU General Public License v3.0
71 stars 1 forks source link

Find a better way to manage randomness #61

Open lkct opened 1 year ago

lkct commented 1 year ago

Ref: discussion in the comments under #58.

We shall make a decision when adding a new argument will not cause much trouble.

loreloc commented 1 year ago

https://docs.python.org/3/library/contextlib.html

lkct commented 1 year ago

Another idea to extend the "random state": we accept anything that supports rand, randn, etc. as a general RNG. However, the implementation can also be a pre-defined deterministic generator -- enabling us to verify all the results by hand with some known "random" sequence. This is useful for unit tests, e.g., on sampling.

arranger1044 commented 2 weeks ago

shall we close this one?