Learn R Programming

dclone (version 1.2-0)

clusterSeed: Parallel random seeds and kinds

Description

Sets the seeds and kinds for random numbers on parallel workers.

Usage

clusterSeed(cl, seed, kind = "default", normal.kind = "default")

Arguments

cl
A cluster object created by makeCluster.
seed
seed argument used by set.seed.
kind
kind argument used by set.seed.
normal.kind
normal.kind argument used by set.seed.

Value

  • Sets rendom seeds and kinds, returns the settings as a list.

See Also

clusterApply, clusterApplyLB

Examples

Run this code
cl <- makeSOCKcluster(2)
## seed not set
clusterCall(cl, rnorm, 3)
## different seeds
clusterSeed(cl, 1:2)
clusterCall(cl, rnorm, 3)
## same seeds
clusterSeed(cl, 1)
clusterCall(cl, rnorm, 3)
stopCluster(cl)

Run the code above in your browser using DataLab