resolve_future_seed: Resolve and validate RNG seed for Future backend

View source: R/mc_is_helpers.R

resolve_future_seedR Documentation

Resolve and validate RNG seed for Future backend

Description

Internal helper to normalize the seed argument used in future_lapply calls within Monte Carlo simulations.

The function ensures that the supplied seed is of a valid type: either a single integer (for deterministic runs), a complete L'Ecuyer-CMRG RNG stream (as returned by nextRNGStream), or NULL/TRUE for fully random behavior.

This avoids common errors such as:

  • "Argument 'seed' must be L'Ecuyer-CMRG RNG seed ..." when passing incomplete streams,

  • identical random numbers on all workers due to improper seeding,

  • non-reproducible results across different backends.

May be one of:

  • A single numeric/integer value (e.g. 1234) - fixed reproducible run.

  • A numeric vector of length 7 (L'Ecuyer-CMRG stream) - substreams per worker.

  • NULL - automatically use fully random streams (future.seed = TRUE).

Usage

resolve_future_seed(seed)

Arguments

seed

Optional seed value provided by user or upstream function.

Value

A normalized object suitable for direct use in the argument future.seed = resolve_future_seed(seed) inside [future.apply::future_lapply()].

Author(s)

(C) 2026 M. Ricker - TU Dortmund University - Chair of Structural Concrete

See Also

[TesiproV::MC_IS()], [parallel::nextRNGStream()], [future.apply::future_lapply()]


TesiproV documentation built on Oct. 28, 2026, 5:13 p.m.