Produces the list that sim_template() hands to each worker process: the
number of replications assigned to that process and the PCG64 seed and
stream that give it an independent random-number stream. The seed vectors
come from dqrng::generateSeedVectors(), which draws from R's own generator,
so the master seed fixes every process's stream.
Arguments
- seed
Master seed, passed to
set.seed().- n_reps
Total number of replications.
- n_cores
Number of worker processes.
Value
A list of length n_cores. Element i is a list with components
n_reps (replications for process i), stream and seed (each a
two-element integer vector for dqrng::dqset.seed()), worker_id
(i), and n_cores.
Details
Calling this function sets R's random number seed with set.seed(seed),
exactly as the book's sim_template does.
Examples
set_up <- make_set_up(1234, 100, 4)
str(set_up[[1]])
#> List of 5
#> $ n_reps : int 25
#> $ stream : int [1:2] -813463916 -724366409
#> $ seed : int [1:2] -1622172679 -597384213
#> $ worker_id: int 1
#> $ n_cores : int 4