Skip to content

Commit 8f1eb8b

Browse files
Fixed determinism issue
1 parent 5c55a5e commit 8f1eb8b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/tlo/methods/demography.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,10 +517,10 @@ def assign_closest_facility_level(self):
517517
}
518518

519519
# Worldpop-weighted coordinate assignment.
520-
# FIX: derive run_seed from the module RNG (not secrets/time) so results are
521-
# reproducible across runs that share the same random seed.
520+
_rng_state = self.rng.get_state()
522521
run_seed = self.rng.randint(0, 2 ** 31 - 1).to_bytes(4, "big")
523-
# FIX: sort districts so iteration order is deterministic regardless of PYTHONHASHSEED.
522+
self.rng.set_state(_rng_state)
523+
524524
unique_districts = sorted(df["district_of_residence"].unique())
525525

526526
district_to_coords = {}

0 commit comments

Comments
 (0)