Skip to main content

seed_for

Function seed_for 

pub const fn seed_for(study_seed: u64, trial_number: u64, stream: Stream) -> u64
Expand description

Derives the seed of one random stream of one trial.

The algorithm absorbs the three inputs through the SplitMix64 finalizer in a fixed order:

h = mix(study_seed ^ GOLDEN_GAMMA)
h = mix(h ^ (trial_number + GOLDEN_GAMMA))
h = mix(h ^ (stream.tag() + GOLDEN_GAMMA))

(additions wrap). Every step is a bijection, so distinct inputs at any one position stay distinct; the golden-ratio constant keeps the common study_seed = 0, trial_number = 0 case from degenerating.

trial_number is the per-study ordinal (TrialNumber), never the storage-global TrialId.

ยงStability

The output values are frozen; see the module documentation.