set_seed: Set and Track Random Seed

View source: R/param_tracking.R

set_seedR Documentation

Set and Track Random Seed

Description

Set a random seed and track it for reproducibility. Note: This function is explicitly designed to set random seeds as requested by the user.

Usage

set_seed(
  seed = NULL,
  kind = NULL,
  normal.kind = NULL,
  sample.kind = NULL,
  analysis_name = NULL,
  registry_file,
  set_seed = TRUE
)

Arguments

seed

Numeric. Random seed to set. If NULL, generates random seed.

kind

Character. RNG kind (see ?set.seed). Default NULL uses current.

normal.kind

Character. Normal RNG kind. Default NULL uses current.

sample.kind

Character. Sample RNG kind. Default NULL uses current.

analysis_name

Character. Name to associate with this seed

registry_file

Character. Path to seed registry (required).

set_seed

Logical. If TRUE, actually sets the seed. If FALSE, only tracks it. Default TRUE.

Value

The seed value (invisibly)

Examples

## Not run: 
# Set and track a specific seed
set_seed(12345, analysis_name = "simulation_1",
         registry_file = tempfile(fileext = ".json"))

# Generate and track a random seed
set_seed(analysis_name = "bootstrap_analysis",
         registry_file = tempfile(fileext = ".json"))

## End(Not run)

Capsule documentation built on Nov. 11, 2025, 5:14 p.m.