Skip to main content

interp_set_seed

Function interp_set_seed 

Source
fn interp_set_seed(
    args: &[RValue],
    _named: &[(String, RValue)],
    context: &BuiltinContext<'_>,
) -> Result<RValue, RError>
Expand description

Set the random number generator seed for reproducibility.

Seeds the per-interpreter RNG deterministically so that subsequent random draws produce the same sequence. The RNG algorithm seeded depends on the current RNGkind() setting — either Xoshiro (default) or ChaCha20.

Also stores the seed value in .Random.seed in the global environment (as an integer vector whose first element is the seed), matching R’s convention of exposing RNG state there.

@param seed integer seed value (or NULL to re-seed from system entropy) @return NULL, invisibly