Skip to content

Commit

Permalink
model: Set seed as keyword argument
Browse files Browse the repository at this point in the history
  • Loading branch information
rht committed Aug 23, 2024
1 parent ebf948a commit 9fc2422
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mesa/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Model:
initialize_data_collector: Sets up the data collector for the model, requiring an initialized scheduler and agents.
"""

def __init__(self, *args: Any, **kwargs: Any) -> None:
def __init__(self, *args: Any, seed: float | None = None, **kwargs: Any) -> None:
"""Create a new model. Overload this method with the actual code to
start the model. Always start with super().__init__() to initialize the
model object properly.
Expand All @@ -59,7 +59,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
self.current_id = 0
self.agents_: defaultdict[type, dict] = defaultdict(dict)

self._seed = kwargs.get("seed")
self._seed = seed
if self._seed is None:
# We explicitly specify the seed here so that we know its value in
# advance.
Expand Down

0 comments on commit 9fc2422

Please sign in to comment.