Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

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

Grant Sanderson3b5dea9a7506
diff --git a/scene/scene.py b/scene/scene.py
index 0238f1e9c..cc2f618de 100644
--- a/scene/scene.py
+++ b/scene/scene.py
@@ -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: