evaluate `code` with the RNG seeded to `seed`, restoring the caller's RNG state afterwards
Source:R/utils.R
with_local_seed.Rd`seed = NULL` runs `code` against the ambient RNG stream unchanged, so a caller can still get reproducibility with a plain `set.seed()` before the call. Any other value makes the call self-contained and repeatable without perturbing the caller's stream.