Common random numbers
Two scenarios that share a seed give each person the same draws, so a difference between them comes from the policy, not from chance.
To compare a policy with a baseline, the two runs should differ only where the policy acts. cohortix gives every person the same random draws in both runs, for every decision the policy does not change. This is called common random numbers.
How draws are keyed
The kernel is the only source of randomness. A plugin asks for the next uniform for one person under a named decision type, such as c:test/Tick.uniform. The draw depends on:
- the run seed, derived from
scenario.seedand the replication, population realization and parameter set numbers; - the decision type;
- the person's id and how many draws that person has had of that decision type.
It does not depend on the order in which people are processed, on threads, or on any other decision type. The generator is Philox4x32-10, a counter-based generator, in integer arithmetic only.
Why the scenario name is not in the seed
scenario.name never enters a seed. A baseline and a policy scenario with the same seed therefore share their draws: each person gets the same uniform for each decision in both runs.
What keeps the draws aligned
- Competing risks take one uniform per call, also when the total hazard is 0, so a changed hazard never shifts later draws.
- Variants of a contract share its decision types, so swapping a variant changes what is done with each draw, not the draws.
- A policy that never applies writes no row, so the journal equals the run without it.
What you see in provenance
The [seed] table of provenance.toml records the root, the population realization, the replication, the parameter set and whether common random numbers hold across parameter sets; [decisions] lists every decision type drawn.
[seed]
crn_across_parameter_sets = false
parameter_set = 0
population_realization = 0
replication = 0
root = 20180101In this version
Paired policy comparison needs [[policies]] in the scenario file, which comes in a later version. The keying above is in place in 0.1 and checked by the engine's tests.