spawn.sprng {rsprng}R Documentation

Spawn new random number streams based on the current one.

Description

Some times when a process spawns children processes, it is desirable to spawn new streams from an old one and pass them on to children. spawn.sprng creates new random number streams based on the current one, and returns them as columns of an integer matrix. These new streams can be then transfered to children processes.

Usage

spawn.sprng (nspawn)

Arguments

nspawn number of new streams to spawn

Value

Return an integer matrix with nstream columns, each column corresponds to one stream. The number of rows will depend on the type of the PRNG.

Author(s)

Na (Michael) Li lina@u.washington.edu

References

SPRNG: Scalable Parallel Random Number Generator Library Web Page. http://sprng.cs.fsu.edu/

See Also

pack.sprng, unpack.sprng, spawn.new.sprng

Examples

init.sprng (1, 0, kind = "CMRG")
child.rngs <- spawn.sprng (3)
unpack.sprng (child.rngs[,1])
runif (10)
unpack.sprng (child.rngs[,2])
runif (10)
free.sprng ()

[Package Contents]