prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Seed and random should not be class attributes
  **Describe the bug**
  <!-- A clear and concise description the bug -->
  
  Every time a model instance is created, it updates the seed and random attribute of every other instance of the same class.
  
  **Expected behavior**
  <!-- A clear and concise description of what you expected to happen -->
  
  I would expect each instance to have their own attribute. This way, the behavior of each instance is independent and predictable.
  
  **To Reproduce**
  <!-- Steps to reproduce the bug, or a link to a project where the bug is visible -->
  
  ```pycon
  >>> from mesa import Model
  >>> class Ex(Model):
  ...   def __init__(self, seed=2):
  ...     pass
  ...
  >>> a = Ex(seed=1)
  >>> print(a._seed, a.random)
  1 <random.Random object at 0x282a8d0>
  >>> b = Ex(seed=2)
  >>> print(a._seed, a.random)
  2 <random.Random object at 0x282b2d0>
  ```
  
  </issue>
  <code>
  [start of mesa/model.py]
  1 """
  2 The model class for Mesa framework.
  3 
  4 Core Objects: Model
  5 
  6 """
  7 # Mypy; for the `|` operator purpose
  8 # Remove this __future__ import once the oldest supported Python is 3.10
  9 from __future__ import annotations
  10 
  11 import random
  12 
  13 from mesa.datacollection import DataCollector
  14 
  15 # mypy
  16 from typing import Any
  17 
  18 
  19 class Model:
  20     """Base class for models."""
  21 
  22     def __new__(cls, *args: Any, **kwargs: Any) -> Any:
  23         """Create a new model object and instantiate its RNG automatically."""
  24         cls._seed = kwargs.get("seed", None)
  25         cls.random = random.Random(cls._seed)
  26         return object.__new__(cls)
  27 
  28     def __init__(self, *args: Any, **kwargs: Any) -> None:
  29         """Create a new model. Overload this method with the actual code to
  30         start the model.
  31 
  32         Attributes:
  33             schedule: schedule object
  34             running: a bool indicating if the model should continue running
  35 
  36         """
  37 
  38         self.running = True
  39         self.schedule = None
  40         self.current_id = 0
  41 
  42     def run_model(self) -> None:
  43         """Run the model until the end condition is reached. Overload as
  44         needed.
  45 
  46         """
  47         while self.running:
  48             self.step()
  49 
  50     def step(self) -> None:
  51         """A single step. Fill in here."""
  52         pass
  53 
  54     def next_id(self) -> int:
  55         """Return the next unique ID for agents, increment current_id"""
  56         self.current_id += 1
  57         return self.current_id
  58 
  59     def reset_randomizer(self, seed: int | None = None) -> None:
  60         """Reset the model random number generator.
  61 
  62         Args:
  63             seed: A new seed for the RNG; if None, reset using the current seed
  64         """
  65 
  66         if seed is None:
  67             seed = self._seed
  68         self.random.seed(seed)
  69         self._seed = seed
  70 
  71     def initialize_data_collector(
  72         self, model_reporters=None, agent_reporters=None, tables=None
  73     ) -> None:
  74         if not hasattr(self, "schedule") or self.schedule is None:
  75             raise RuntimeError(
  76                 "You must initialize the scheduler (self.schedule) before initializing the data collector."
  77             )
  78         if self.schedule.get_agent_count() == 0:
  79             raise RuntimeError(
  80                 "You must add agents to the scheduler before initializing the data collector."
  81             )
  82         self.datacollector = DataCollector(
  83             model_reporters=model_reporters,
  84             agent_reporters=agent_reporters,
  85             tables=tables,
  86         )
  87         # Collect data for the first time during initialization.
  88         self.datacollector.collect(self)
  89
  [end of mesa/model.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/mesa/model.py b/mesa/model.py
  --- a/mesa/model.py
  +++ b/mesa/model.py
  @@ -21,9 +21,10 @@
   
       def __new__(cls, *args: Any, **kwargs: Any) -> Any:
           """Create a new model object and instantiate its RNG automatically."""
  -        cls._seed = kwargs.get("seed", None)
  -        cls.random = random.Random(cls._seed)
  -        return object.__new__(cls)
  +        obj = object.__new__(cls)
  +        obj._seed = kwargs.get("seed", None)
  +        obj.random = random.Random(obj._seed)
  +        return obj
   
       def __init__(self, *args: Any, **kwargs: Any) -> None:
           """Create a new model. Overload this method with the actual code to
  
verification_info: {"golden_diff": "diff --git a/mesa/model.py b/mesa/model.py\n--- a/mesa/model.py\n+++ b/mesa/model.py\n@@ -21,9 +21,10 @@\n \n     def __new__(cls, *args: Any, **kwargs: Any) -> Any:\n         \"\"\"Create a new model object and instantiate its RNG automatically.\"\"\"\n-        cls._seed = kwargs.get(\"seed\", None)\n-        cls.random = random.Random(cls._seed)\n-        return object.__new__(cls)\n+        obj = object.__new__(cls)\n+        obj._seed = kwargs.get(\"seed\", None)\n+        obj.random = random.Random(obj._seed)\n+        return obj\n \n     def __init__(self, *args: Any, **kwargs: Any) -> None:\n         \"\"\"Create a new model. Overload this method with the actual code to\n", "issue": "Seed and random should not be class attributes\n**Describe the bug**\r\n<!-- A clear and concise description the bug -->\r\n\r\nEvery time a model instance is created, it updates the seed and random attribute of every other instance of the same class.\r\n\r\n**Expected behavior**\r\n<!-- A clear and concise description of what you expected to happen -->\r\n\r\nI would expect each instance to have their own attribute. This way, the behavior of each instance is independent and predictable.\r\n\r\n**To Reproduce**\r\n<!-- Steps to reproduce the bug, or a link to a project where the bug is visible -->\r\n\r\n```pycon\r\n>>> from mesa import Model\r\n>>> class Ex(Model):\r\n...   def __init__(self, seed=2):\r\n...     pass\r\n...\r\n>>> a = Ex(seed=1)\r\n>>> print(a._seed, a.random)\r\n1 <random.Random object at 0x282a8d0>\r\n>>> b = Ex(seed=2)\r\n>>> print(a._seed, a.random)\r\n2 <random.Random object at 0x282b2d0>\r\n```\n", "before_files": [{"content": "\"\"\"\nThe model class for Mesa framework.\n\nCore Objects: Model\n\n\"\"\"\n# Mypy; for the `|` operator purpose\n# Remove this __future__ import once the oldest supported Python is 3.10\nfrom __future__ import annotations\n\nimport random\n\nfrom mesa.datacollection import DataCollector\n\n# mypy\nfrom typing import Any\n\n\nclass Model:\n    \"\"\"Base class for models.\"\"\"\n\n    def __new__(cls, *args: Any, **kwargs: Any) -> Any:\n        \"\"\"Create a new model object and instantiate its RNG automatically.\"\"\"\n        cls._seed = kwargs.get(\"seed\", None)\n        cls.random = random.Random(cls._seed)\n        return object.__new__(cls)\n\n    def __init__(self, *args: Any, **kwargs: Any) -> None:\n        \"\"\"Create a new model. Overload this method with the actual code to\n        start the model.\n\n        Attributes:\n            schedule: schedule object\n            running: a bool indicating if the model should continue running\n\n        \"\"\"\n\n        self.running = True\n        self.schedule = None\n        self.current_id = 0\n\n    def run_model(self) -> None:\n        \"\"\"Run the model until the end condition is reached. Overload as\n        needed.\n\n        \"\"\"\n        while self.running:\n            self.step()\n\n    def step(self) -> None:\n        \"\"\"A single step. Fill in here.\"\"\"\n        pass\n\n    def next_id(self) -> int:\n        \"\"\"Return the next unique ID for agents, increment current_id\"\"\"\n        self.current_id += 1\n        return self.current_id\n\n    def reset_randomizer(self, seed: int | None = None) -> None:\n        \"\"\"Reset the model random number generator.\n\n        Args:\n            seed: A new seed for the RNG; if None, reset using the current seed\n        \"\"\"\n\n        if seed is None:\n            seed = self._seed\n        self.random.seed(seed)\n        self._seed = seed\n\n    def initialize_data_collector(\n        self, model_reporters=None, agent_reporters=None, tables=None\n    ) -> None:\n        if not hasattr(self, \"schedule\") or self.schedule is None:\n            raise RuntimeError(\n                \"You must initialize the scheduler (self.schedule) before initializing the data collector.\"\n            )\n        if self.schedule.get_agent_count() == 0:\n            raise RuntimeError(\n                \"You must add agents to the scheduler before initializing the data collector.\"\n            )\n        self.datacollector = DataCollector(\n            model_reporters=model_reporters,\n            agent_reporters=agent_reporters,\n            tables=tables,\n        )\n        # Collect data for the first time during initialization.\n        self.datacollector.collect(self)\n", "path": "mesa/model.py"}]}