RNGStreams: Parallel RNG Streams

View source: R/utils.R

RNGStreamsR Documentation

Parallel RNG Streams

Description

These functions provide utilities for working with multiple streams of pseudo-random numbers.

Usage

RNGStreams(n = length(size), size = 1L)

getRNGStream()

setRNGStream(seed = NULL, kind = NULL)

Arguments

n

The number of RNG streams to create.

size

If RNGkind is set to "L'Ecuyer-CMRG", then iterate this number of RNG substreams between each returned stream.

seed

A valid RNG stream to assign to .Random.seed, or a list with elements named seed and kind.

kind

The RNGkind to use when setting the RNG stream.

Value

For RNGStreams, a list of length n with RNG streams (with elements named seed and kind) for use with setRNGStream.

Author(s)

Kylie A. Bemis

See Also

RNGkind, nextRNGStream

Examples

# create parallel RNG streams
register(SerialParam())
RNGkind("L'Ecuyer-CMRG")
set.seed(1)
seeds <- RNGStreams(4)
seeds

kuwisdelu/matter documentation built on July 16, 2024, 1:28 p.m.