SeedManager
run.SeedManager(seed=None)Root seed source that spawns independent child generators.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| seed | int | None |
Root seed. None draws fresh OS entropy; record entropy afterwards to reproduce the run. |
None |
Example
from heormodel.run import SeedManager sm = SeedManager(42) rng = sm.generator() children = sm.spawn(3) len(children) 3 bool(SeedManager(42).spawn(3)[0].integers(100) == children[0].integers(100)) True
Attributes
| Name | Description |
|---|---|
| entropy | The root entropy; persist this to reproduce the run exactly. |
Methods
| Name | Description |
|---|---|
| child_sequence | A child seed sequence addressed by a stable integer key. |
| generator | A generator for run-level randomness (e.g. parameter sampling). |
| spawn | Spawn n statistically independent child generators. |
child_sequence
run.SeedManager.child_sequence(key)A child seed sequence addressed by a stable integer key.
Unlike spawn, the returned sequence depends only on key and this manager’s seed, not on call order. Keying by iteration index gives per-iteration streams that stay identical however a run is chunked across workers. Spawn from the sequence for sub-streams (population sampling, per-intervention randomness).
Example
from heormodel.run import SeedManager import numpy as np a = SeedManager(7).child_sequence(3) b = SeedManager(7).child_sequence(3) int(np.random.default_rng(a).integers(1_000_000)) == int( … np.random.default_rng(b).integers(1_000_000)) True
generator
run.SeedManager.generator()A generator for run-level randomness (e.g. parameter sampling).
spawn
run.SeedManager.spawn(n)Spawn n statistically independent child generators.
Repeated calls continue the spawn sequence, so children never repeat within one manager.