R Under development (unstable) (2023-12-20 r85711 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > source("incl/start,load-only.R") [13:14:23.190] Detected 'R CMD check': - adjusting defaults to be a good citizen [13:14:23.193] Set package option 'parallelly.availableCores.methods' [13:14:23.193] Environment variable 'R_PARALLELLY_AVAILABLECORES_METHODS' not set [13:14:23.193] Set package option 'parallelly.availableCores.fallback' [13:14:23.194] Environment variable 'R_PARALLELLY_AVAILABLECORES_FALLBACK' not set [13:14:23.194] Set package option 'parallelly.availableCores.min' [13:14:23.194] Environment variable 'R_PARALLELLY_AVAILABLECORES_MIN' not set [13:14:23.195] Set package option 'parallelly.availableCores.system' [13:14:23.195] Environment variable 'R_PARALLELLY_AVAILABLECORES_SYSTEM' not set [13:14:23.195] Set package option 'parallelly.availableCores.logical' [13:14:23.196] Environment variable 'R_PARALLELLY_AVAILABLECORES_LOGICAL' not set [13:14:23.196] Set package option 'parallelly.availableCores.omit' [13:14:23.196] Environment variable 'R_PARALLELLY_AVAILABLECORES_OMIT' not set [13:14:23.196] Set package option 'parallelly.availableWorkers.methods' [13:14:23.197] Environment variable 'R_PARALLELLY_AVAILABLEWORKERS_METHODS' not set [13:14:23.197] Set package option 'parallelly.fork.enable' [13:14:23.197] Environment variable 'R_PARALLELLY_FORK_ENABLE' not set [13:14:23.197] Set package option 'parallelly.supportsMulticore.disableOn' [13:14:23.198] Environment variable 'R_PARALLELLY_SUPPORTSMULTICORE_DISABLEON' not set [13:14:23.198] Set package option 'parallelly.supportsMulticore.unstable' [13:14:23.198] Environment variable 'R_PARALLELLY_SUPPORTSMULTICORE_UNSTABLE' not set [13:14:23.199] Set package option 'parallelly.makeNodePSOCK.setup_strategy' [13:14:23.199] Environment variable 'R_PARALLELLY_MAKENODEPSOCK_SETUP_STRATEGY' not set [13:14:23.199] Set package option 'parallelly.makeNodePSOCK.validate' [13:14:23.199] Environment variable 'R_PARALLELLY_MAKENODEPSOCK_VALIDATE' not set [13:14:23.200] Set package option 'parallelly.makeNodePSOCK.connectTimeout' [13:14:23.200] R_PARALLELLY_MAKENODEPSOCK_CONNECTTIMEOUT='120' [13:14:23.200] Coercing from character to numeric: '120' [13:14:23.201] => options("parallelly.makeNodePSOCK.connectTimeout" = '120') [n=1, mode=double] [13:14:23.201] Set package option 'parallelly.makeNodePSOCK.timeout' [13:14:23.201] R_PARALLELLY_MAKENODEPSOCK_TIMEOUT='120' [13:14:23.201] Coercing from character to numeric: '120' [13:14:23.202] => options("parallelly.makeNodePSOCK.timeout" = '120') [n=1, mode=double] [13:14:23.202] Set package option 'parallelly.makeNodePSOCK.useXDR' [13:14:23.202] Environment variable 'R_PARALLELLY_MAKENODEPSOCK_USEXDR' not set [13:14:23.202] Set package option 'parallelly.makeNodePSOCK.socketOptions' [13:14:23.203] Environment variable 'R_PARALLELLY_MAKENODEPSOCK_SOCKETOPTIONS' not set [13:14:23.203] Set package option 'parallelly.makeNodePSOCK.rshcmd' [13:14:23.203] Environment variable 'R_PARALLELLY_MAKENODEPSOCK_RSHCMD' not set [13:14:23.204] Set package option 'parallelly.makeNodePSOCK.rshopts' [13:14:23.204] Environment variable 'R_PARALLELLY_MAKENODEPSOCK_RSHOPTS' not set [13:14:23.204] Set package option 'parallelly.makeNodePSOCK.tries' [13:14:23.204] Environment variable 'R_PARALLELLY_MAKENODEPSOCK_TRIES' not set [13:14:23.205] Set package option 'parallelly.makeNodePSOCK.tries.delay' [13:14:23.205] Environment variable 'R_PARALLELLY_MAKENODEPSOCK_TRIES_DELAY' not set [13:14:23.205] Set package option 'parallelly.makeNodePSOCK.rscript_label' [13:14:23.205] R_PARALLELLY_MAKENODEPSOCK_RSCRIPT_LABEL='TRUE' [13:14:23.206] => options("parallelly.makeNodePSOCK.rscript_label" = 'TRUE') [n=1, mode=character] [13:14:23.206] Set package option 'parallelly.makeNodePSOCK.sessionInfo.pkgs' [13:14:23.206] R_PARALLELLY_MAKENODEPSOCK_SESSIONINFO_PKGS='TRUE' [13:14:23.207] => options("parallelly.makeNodePSOCK.sessionInfo.pkgs" = 'TRUE') [n=1, mode=character] [13:14:23.207] Set package option 'parallelly.makeNodePSOCK.autoKill' [13:14:23.207] R_PARALLELLY_MAKENODEPSOCK_AUTOKILL='TRUE' [13:14:23.207] Coercing from character to logical: 'TRUE' [13:14:23.208] => options("parallelly.makeNodePSOCK.autoKill" = 'TRUE') [n=1, mode=logical] [13:14:23.208] Set package option 'parallelly.makeNodePSOCK.master.localhost.hostname' [13:14:23.208] Environment variable 'R_PARALLELLY_MAKENODEPSOCK_MASTER_LOCALHOST_HOSTNAME' not set [13:14:23.208] Set package option 'parallelly.makeNodePSOCK.port.increment' [13:14:23.209] Environment variable 'R_PARALLELLY_MAKENODEPSOCK_PORT_INCREMENT' not set [13:14:23.210] parallelly-specific environment variables: - R_PARALLELLY_MAKENODEPSOCK_AUTOKILL='TRUE' - R_PARALLELLY_MAKENODEPSOCK_CONNECTTIMEOUT='120' - R_PARALLELLY_MAKENODEPSOCK_RSCRIPT_LABEL='TRUE' - R_PARALLELLY_MAKENODEPSOCK_SESSIONINFO_PKGS='TRUE' - R_PARALLELLY_MAKENODEPSOCK_TIMEOUT='120' - R_PARALLELLY_RANDOM_PORTS='20000:39999' [13:14:23.218] Future-specific environment variables: [13:14:23.218] Environment variable 'R_FUTURE_DEMO_MANDELBROT_REGION' not set [13:14:23.219] Environment variable 'R_FUTURE_DEMO_MANDELBROT_NROW' not set [13:14:23.219] Environment variable 'R_FUTURE_DEPRECATED_IGNORE' not set [13:14:23.219] Environment variable 'R_FUTURE_DEPRECATED_DEFUNCT' not set [13:14:23.219] Environment variable 'R_FUTURE_FORK_MULTITHREADING_ENABLE' not set [13:14:23.219] Environment variable 'R_FUTURE_GLOBALS_MAXSIZE' not set [13:14:23.219] Environment variable 'R_FUTURE_GLOBALS_ONMISSING' not set [13:14:23.220] Environment variable 'R_FUTURE_GLOBALS_ONREFERENCE' not set [13:14:23.220] Environment variable 'R_FUTURE_GLOBALS_METHOD' not set [13:14:23.220] Environment variable 'R_FUTURE_GLOBALS_RESOLVE' not set [13:14:23.220] Environment variable 'R_FUTURE_LAZY_ASSERTOWNER' not set [13:14:23.220] Environment variable 'R_FUTURE_PLAN' not set [13:14:23.221] Environment variable 'R_FUTURE_PLAN_DISALLOW' not set [13:14:23.221] Environment variable 'R_FUTURE_PSOCK_RELAY_IMMEDIATE' not set [13:14:23.221] Environment variable 'R_FUTURE_RELAY_IMMEDIATE' not set [13:14:23.221] Environment variable 'R_FUTURE_RESOLVE_RECURSIVE' not set [13:14:23.221] Environment variable 'R_FUTURE_ALIVE_TIMEOUT' not set [13:14:23.222] Environment variable 'R_FUTURE_RESOLVED_TIMEOUT' not set [13:14:23.222] Environment variable 'R_FUTURE_CLUSTER_RESOLVED_TIMEOUT' not set [13:14:23.222] Environment variable 'R_FUTURE_MULTICORE_RESOLVED_TIMEOUT' not set [13:14:23.222] Environment variable 'R_FUTURE_ONFUTURECONDITION_KEEPFUTURE' not set [13:14:23.222] Environment variable 'R_FUTURE_RNG_ONMISUSE' not set [13:14:23.222] Environment variable 'R_FUTURE_GLOBALENV_ONMISUSE' not set [13:14:23.223] Environment variable 'R_FUTURE_WAIT_TIMEOUT' not set [13:14:23.223] Environment variable 'R_FUTURE_WAIT_INTERVAL' not set [13:14:23.223] Environment variable 'R_FUTURE_WAIT_ALPHA' not set [13:14:23.223] Environment variable 'R_FUTURE_ASSIGN_GLOBALS_EXCLUDE' not set [13:14:23.223] Environment variable 'R_FUTURE_OUTPUT_WINDOWS_REENCODE' not set [13:14:23.224] Environment variable 'R_FUTURE_GLOBALS_GLOBALSOF_LOCALS' not set [13:14:23.224] Environment variable 'R_FUTURE_STATE_ONINVALID' not set [13:14:23.224] Environment variable 'R_FUTURE_JOURNAL' not set [13:14:23.224] Environment variable 'R_FUTURE_GLOBALS_KEEPWHERE' not set [13:14:23.225] R process uuid: e52765b3-6f1b-397d-9dc9-c7875a4d6d45 [13:14:23.225] Setting plan('default') [13:14:23.226] plan(): Setting new future strategy stack: [13:14:23.226] List of future strategies: [13:14:23.226] 1. sequential: [13:14:23.226] - args: function (..., envir = parent.frame(), workers = "") [13:14:23.226] - tweaked: FALSE [13:14:23.226] - call: NULL [13:14:23.228] plan(): nbrOfWorkers() = 1 [13:14:23.255] plan(): Setting new future strategy stack: [13:14:23.255] List of future strategies: [13:14:23.255] 1. sequential: [13:14:23.255] - args: function (..., envir = parent.frame(), workers = "") [13:14:23.255] - tweaked: FALSE [13:14:23.255] - call: future::plan("sequential") [13:14:23.267] plan(): nbrOfWorkers() = 1 > > message("*** RNG ...") *** RNG ... > > set_random_seed(seed = NULL) Warning in rm(list = ".Random.seed", envir = env, inherits = FALSE) : object '.Random.seed' not found > seed <- get_random_seed() > stopifnot(is.null(seed)) > > set_random_seed(seed = 42L) > seed <- get_random_seed() > stopifnot(identical(seed, 42L)) > > res <- tryCatch({ + seed <- as_lecyer_cmrg_seed(seed = FALSE) + }, error = identity) > print(res) > stopifnot(inherits(res, "error")) > > seed <- as_lecyer_cmrg_seed(seed = 42L) Warning in RNGkind("L'Ecuyer-CMRG") : '.Random.seed[1]' is not a valid RNG kind so ignored > str(seed) int [1:7] 10407 -2133391687 507561766 1260545903 1362917092 -1772566379 -1344458670 > stopifnot(is_lecyer_cmrg_seed(seed)) > set_random_seed(seed = seed) > stopifnot(identical(get_random_seed(), seed)) > > seed2 <- as_lecyer_cmrg_seed(seed = TRUE) > str(seed2) int [1:7] 10407 -2133391687 507561766 1260545903 1362917092 -1772566379 -1344458670 > stopifnot(identical(seed2, seed)) > > seed3 <- as_lecyer_cmrg_seed(seed = seed) > str(seed3) int [1:7] 10407 -2133391687 507561766 1260545903 1362917092 -1772566379 -1344458670 > stopifnot(identical(seed3, seed)) > > ## A random seed > seed4 <- as_lecyer_cmrg_seed(seed = NA) > str(seed4) int [1:7] 10407 1279540750 -941988041 -2007404020 745992093 -1794778694 2071448563 > stopifnot(is_lecyer_cmrg_seed(seed4)) > > > message(" - make_rng_seeds ...") - make_rng_seeds ... > > seeds <- make_rng_seeds(2L, seed = NULL) > stopifnot(is.null(seeds)) > > seeds <- make_rng_seeds(2L, seed = FALSE) > stopifnot(is.null(seeds)) > > seeds <- make_rng_seeds(0L, seed = 42L) [13:14:23.284] Generating random seeds ... [13:14:23.284] Generating random seed streams for 0 elements ... [13:14:23.285] Generating random seed streams for 0 elements ... DONE [13:14:23.285] Generating random seeds ... DONE > stopifnot(length(seeds) == 0L, identical(seeds, list())) > > seeds <- make_rng_seeds(2L, seed = TRUE) [13:14:23.285] Generating random seeds ... [13:14:23.285] Generating random seed streams for 2 elements ... [13:14:23.285] Generating random seed streams for 2 elements ... DONE [13:14:23.286] Generating random seeds ... DONE > stopifnot(length(seeds) == 2L, all(sapply(seeds, FUN = is_lecyer_cmrg_seed))) > > seeds <- make_rng_seeds(3L, seed = 42L) [13:14:23.286] Generating random seeds ... [13:14:23.286] Generating random seed streams for 3 elements ... [13:14:23.286] Generating random seed streams for 3 elements ... DONE [13:14:23.287] Generating random seeds ... DONE > stopifnot(length(seeds) == 3L, all(sapply(seeds, FUN = is_lecyer_cmrg_seed))) > > seeds <- make_rng_seeds(1L, seed = 42L) [13:14:23.287] Generating random seeds ... [13:14:23.287] Generating random seed streams for 1 elements ... [13:14:23.287] Generating random seed streams for 1 elements ... DONE [13:14:23.287] Generating random seeds ... DONE > stopifnot(length(seeds) == 1L, all(sapply(seeds, FUN = is_lecyer_cmrg_seed))) > > seeds0 <- lapply(1:3, FUN = as_lecyer_cmrg_seed) > seeds <- make_rng_seeds(length(seeds0), seed = seeds0) [13:14:23.288] Generating random seeds ... [13:14:23.288] Using a pre-define stream of 3 random seeds ... [13:14:23.289] Using a pre-define stream of 3 random seeds ... DONE [13:14:23.290] Generating random seeds ... DONE > stopifnot(length(seeds) == length(seeds0), + all(sapply(seeds, FUN = is_lecyer_cmrg_seed))) > > > message(" - exceptions ...") - exceptions ... > > ## Invalid L'Ecuyer seed > seed_invalid <- seed + 1L > res <- tryCatch({ + seed <- as_lecyer_cmrg_seed(seed = seed_invalid) + }, error = identity) > print(res) > stopifnot(inherits(res, "error")) > > ## Invalid seed > res <- tryCatch({ + seed <- as_lecyer_cmrg_seed(seed = 1:2) + }, error = identity) > print(res) > stopifnot(inherits(res, "error")) > > ## Invalid length > seeds0 <- lapply(1:2, FUN = as_lecyer_cmrg_seed) > res <- tryCatch({ + seeds <- make_rng_seeds(1L, seed = seeds0) + }, error = identity) [13:14:23.292] Generating random seeds ... [13:14:23.292] Using a pre-define stream of 1 random seeds ... > print(res) > stopifnot(inherits(res, "error")) > > ## Seeds of different kinds > seeds0 <- lapply(1:2, FUN = as_lecyer_cmrg_seed) > seeds0[[1]] <- seeds0[[1]][-1] > res <- tryCatch({ + seeds <- make_rng_seeds(2L, seed = seeds0) + }, error = identity) [13:14:23.292] Generating random seeds ... [13:14:23.292] Using a pre-define stream of 2 random seeds ... > print(res) > stopifnot(inherits(res, "error")) > > ## List of scalar seeds? > res <- tryCatch({ + seeds <- make_rng_seeds(1L, seed = list(42L)) + }, error = identity) [13:14:23.293] Generating random seeds ... [13:14:23.293] Using a pre-define stream of 1 random seeds ... > print(res) > stopifnot(inherits(res, "error")) > > ## Not seeds at all? > seeds0 <- lapply(1:2, FUN = as_lecyer_cmrg_seed) > seeds0[[1]] <- letters[1:7] > res <- tryCatch({ + seeds <- make_rng_seeds(2L, seed = seeds0) + }, error = identity) [13:14:23.294] Generating random seeds ... [13:14:23.294] Using a pre-define stream of 2 random seeds ... > print(res) > stopifnot(inherits(res, "error")) > > ## Invalid seeds? > seeds0 <- lapply(1:2, FUN = as_lecyer_cmrg_seed) > seeds0 <- lapply(seeds0, FUN = rev) > res <- tryCatch({ + seeds <- make_rng_seeds(2L, seed = seeds0) + }, error = identity) [13:14:23.294] Generating random seeds ... [13:14:23.294] Using a pre-define stream of 2 random seeds ... > print(res) > stopifnot(inherits(res, "error")) > > > message(" - replicated RNG draws") - replicated RNG draws > library(future.apply) Loading required package: future [13:14:23.302] Option 'future.startup.script': TRUE [13:14:23.302] Future startup scripts considered: '.future.R', '~/.future.R' [13:14:23.303] Future startup scripts found: > > seed_org <- next_random_seed() > set.seed(42) > > ## Draw two random number from 1:100 one after the other > seed_before <- get_random_seed() > kind_before <- RNGkind() > x <- sample.int(100L, size = 5L) > y <- sample.int(100L, size = 5L) > seed_after <- get_random_seed() > kind_after <- RNGkind() > print(c(x, y)) [1] 2 4 63 76 97 9 85 10 66 23 > > ## Draw two random number from 1:100 at once > set_random_seed(seed_before) > kind_before2 <- RNGkind() > z <- sample.int(100L, size = 10L) > seed_after2 <- get_random_seed() > kind_after2 <- RNGkind() > print(z) [1] 2 4 63 76 97 9 85 10 66 23 > > ## The RNG state is the same after the second ... > ## run as after the first, two-step, approach > stopifnot(identical(seed_after2, seed_after)) > stopifnot(identical(kind_before2, kind_before)) > stopifnot(identical(kind_after2, kind_after)) > > ## .... and the exact same set of random numbers where > ## drawn [only true in R (>= 4.0.0)] > if (getRversion() >= "4.0.0") { + stopifnot(identical(z, c(x, y))) + } else { + stopifnot(identical(z[seq_along(x)], x)) + } > > set_random_seed(seed_org) > stopifnot(identical(get_random_seed(), seed_org)) > > message("*** RNG ... DONE") *** RNG ... DONE > > source("incl/end.R") [13:14:23.306] plan(): Setting new future strategy stack: [13:14:23.307] List of future strategies: [13:14:23.307] 1. FutureStrategy: [13:14:23.307] - args: function (..., envir = parent.frame(), workers = "") [13:14:23.307] - tweaked: FALSE [13:14:23.307] - call: future::plan(oplan) [13:14:23.319] plan(): nbrOfWorkers() = 1 > > proc.time() user system elapsed 0.26 0.09 0.34