RNGStreams | R Documentation |
These functions provide utilities for working with multiple streams of pseudo-random numbers.
RNGStreams(n, parallel = FALSE)
getRNGStream(env = globalenv())
setRNGStream(seed = NULL, env = globalenv())
n |
The number of RNG streams to create. |
parallel |
Should the |
env |
The environment in which to get or set the random number generator. Defaults to the global environment. |
seed |
A valid RNG stream to assign to |
For RNGStreams
a list of length n
with RNG streams for .Random.seed
.
Kylie A. Bemis
RNGkind
,
nextRNGStream
# initialize parallel RNG
RNGStreams(parallel=TRUE)
# create and use RNG streams
register(SerialParam())
set.seed(1)
seeds <- RNGStreams(5)
chunkLapply(rep.int(10, 5), rnorm, seeds=seeds)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.