R Under development (unstable) (2024-10-17 r87242 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 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. > if(FALSE) + { + library(randtoolbox) + library(parallel) + + #init can be used to continue the sequence + halton(1, init=TRUE) + halton(10, init=FALSE) + #should be the same + halton(11, init=TRUE) + + #init can be used to continue the sequence + sobol(1, init=TRUE) + sobol(10, init=FALSE) + #should be the same + sobol(11, init=TRUE) + + + sobol(1:10, scramb=3, init=TRUE, seed=4711) + sobol(1:10, scramb=3, init=TRUE, seed=6523) + + + + if (.Platform$OS.type == "windows") + { + parallel <- "snow" + type <- "PSOCK" + }else + { + parallel <- "multicore" + type <- "FORK" + } + + + + func <- function(i, n) + { + u <- sobol(n, scramb=3, init=TRUE, seed=4711*i) + c(quantile(u), mean=mean(u), var=var(u)) + } + + clus <- parallel::makeCluster(2, type = type) + parallel::clusterEvalQ(clus, library(randtoolbox)) + res <- parallel::parSapply(clus, 1:2, func, n=1e4) + parallel::stopCluster(clus) + + res + } > > > proc.time() user system elapsed 0.18 0.04 0.21