lundi 4 mars 2019

Does a random seed set via numpy.random.seed maintain across submodules?

If I set a seed for my RNG e.g. numpy.random.seed(0) and I call a submodule, will the RNG's state be maintained?

e.g.

# some_lib.py
def do_thing():
  return numpy.random.rand()

# parent module
import some_lib
numpy.seed(0)
...
some_lib.do_thing()

Will the numpy state set by the parent be used by the child?




Aucun commentaire:

Enregistrer un commentaire