Nice to be able to have a random seed in the configuration of Scenes

This commit is contained in:
Grant Sanderson 2017-12-06 15:17:59 -08:00
parent 81d201e983
commit 3b5dea9a75

View file

@ -33,6 +33,7 @@ class Scene(object):
"output_directory" : MOVIE_DIR,
"name" : None,
"always_continually_update" : False,
"random_seed" : None,
}
def __init__(self, **kwargs):
digest_config(self, kwargs)
@ -45,6 +46,9 @@ class Scene(object):
self.shared_locals = {}
if self.name is None:
self.name = self.__class__.__name__
if self.random_seed is not None:
random.seed(self.random_seed)
np.random.seed(self.random_seed)
self.setup()
if self.write_to_movie: