diff --git a/mesa/space.py b/mesa/space.py index b9044387234..2be9503eef7 100644 --- a/mesa/space.py +++ b/mesa/space.py @@ -461,6 +461,7 @@ def move_agent_to_one_of( # Find the closest position without sorting all positions closest_pos = None min_distance = float("inf") + agent.random.shuffle(pos) for p in pos: distance = self._distance_squared(p, current_pos) if distance < min_distance: