Given a callable / fixture name and an integer seed, derive a stable
R-side seed value via SHA-256, install it with [set.seed()], and
return it invisibly. The matched Python helper
morie._det_rng.from_seed(name, seed) builds a numpy.random.Generator
from the same SHA digest so bootstrap / MCMC draws on the two sides
agree to Monte-Carlo tolerance (and bit-identical when a
deterministic-pseudo-bootstrap mode is plumbed).
Value
Integer seed installed via set.seed() (invisibly).
Details
Mechanism: SHA-256(paste0(name, ":", seed)) is truncated to 32 bytes;
bytes [9:12] (1-indexed, i.e. hex chars 17..24) form a 32-bit value
reduced modulo 2^31 - 1 and passed to [set.seed()]. Bytes [1:8]
are reserved for the Python Philox key; morie's morie/_det_rng.py is
the Python counterpart.
Requires either the digest or openssl package for SHA-256. Both
are widely available on CRAN; we try digest first, then openssl,
and finally fall back to an internal pure-R SHA-256 implementation
loaded only when neither is available. In practice CRAN reverse
dependencies of morie ship with at least one of the two.
