Learn R Programming

rlecuyer (version 0.3-8)

CreateStream: Spawn new streams

Description

.lec.CreateStream creates new streams of random numbers. .lec.StreamExists checks the existence of a stream.

Usage

.lec.CreateStream (names)
.lec.StreamExists (name)

Value

.lec.StreamExists returns TRUE or FALSE.

Arguments

names

a character string or a vector of character strings naming the streams to be created. The argument must be provided and the names must be unique within the set of existing streams. If for one i a stream of the name names[i] already exists, its state is replaced by the state of the new created stream.

name

name of stream

Details

.lec.CreateStream is a wrapper function for the C function RngStream_CreateStream (L'Ecuyer et al, 2002). The state of the created stream returned by the C function is stored in the global object .lec.Random.seed.table.

.lec.StreamExists returns TRUE if the stream is found in .lec.Random.seed.table, otherwise FALSE.

References

P. L'Ecuyer, R. Simard, E.J.Chen and W.D.Kelton: An Object-Oriented Random-Number Package With Many Long Streams and Substreams; Operations Research, vol. 50, nr. 6, 2002.

Examples

Run this code
nstreams <- 10       # number of streams
names <- paste("mystream",1:nstreams,sep="")
.lec.CreateStream(names)
.lec.WriteStateFull(names)

Run the code above in your browser using DataLab