Description Usage Arguments Details Examples

Initialize independent random number streams to be used in the cluster. It uses the L'Ecuyer's random number generator implemented in the rlecuyer package.

1 2 | ```
clusterSetupRNG.FT (cl, type = "RNGstream", streamper="replicate", ...)
clusterSetupRNGstreamRepli (cl, seed=rep(12345,6), n, ...)
``` |

`cl` |
Cluster object. |

`type` |
Type of the RNG. Currently, only |

`streamper` |
Mode of the inititalization. Value |

`...` |
Arguments passed to the underlying function (see details bellow). |

`seed` |
A single integer or a vector of six integer values used as seed for the RNG. |

`n` |
Number of streams to be created. It should correspond to the number of replicates in the computation. |

`clusterSetupRNG.FT`

calls one of
the following functions, while passing arguments `(cl, ...)`

: For
`streamper="node"`

, the snow function `clusterSetupRNGstream`

is
called; For
`streamper="replicate"`

, the function
`clusterSetupRNGstreamRepli`

is called. In the latter case, the
argument `n`

has to be given that corresponds to the total number
of streams created for the computation. This mode is used by `clusterApplyFT`

.
Note that when using the function
`performParallel`

,
the user does not need to initialize the RNG separately, since it is
accomplished within the function.

`clusterSetupRNGstreamRepli`

loads the rlecuyer package
and on each node it creates `n`

streams. The
streams are named by their ordinal number.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ```
## Not run:
# Generate 50 independent (normally distributed) random numbers
# on 3 nodes using 10 RNG streams
cl <- makeClusterFT(3)
r <- 10
# reproducible results
for (i in 1:3) {
clusterSetupRNG.FT(cl, streamper = "replicate", n = r, seed = 123)
cat("\n")
print(unlist(clusterApplyFT(cl, rep(5,r), rnorm, gentype = "RNGstream")[[1]]))
}
# non-reproducible results (method used in snow)
for (i in 1:3) {
clusterSetupRNG.FT(cl, streamper = "node", seed = 123)
cat("\n")
print(unlist(clusterApplyFT(cl, rep(5,r), rnorm, gentype = "RNGstream")[[1]]))
}
stopClusterFT(cl)
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.