Learn R Programming

rstream (version 1.0)

rstream.reset-methods: Methods for Function rstream.reset in Package `rstream'

Description

Reset "rstream" object in package rstream into its initial state.

By resetting the stream object the same stream of random numbers can be generated.

Usage

rstream.reset(stream)

Arguments

stream
an "rstream" object.

Methods

Methods available for all "rstream" subclasses: rstream.lecuyer-class, rstream.runif-class.

See Also

rstream-class.

Examples

Run this code
## create a new rstream object (of subclass rstream.lecuyer)
s <- new("rstream.lecuyer")

## generate a sample
x <- rstream.sample(s,10)

## reset the stream object
rstream.reset(s)

## the new sample y is identical to x
y <- rstream.sample(s,10)
if (identical(x,y)) print("x and y are identical samples")

Run the code above in your browser using DataLab