set_seed: Set a reproducible RNG seed across R versions

View source: R/set_seed.R

set_seedR Documentation

Set a reproducible RNG seed across R versions

Description

The change in how set.seed works in R 3.6 prompted the creation of this R version agnostic replacement to get unit test code to work on multiple versions of R in a CICD test build.

Usage

set_seed(seed = 1L)

Arguments

seed

argument to set.seed

Details

It seems RNGkind(sample.kind="Rounding") does not work prior to version 3.6 so I resorted to using version dependent construction of the argument list to set.seed() in do.call().

Value

NULL, invisibly.

Examples

set_seed(1)
rnorm(5)

nprcgenekeepr documentation built on July 26, 2026, 5:06 p.m.