reset - Reset random number stream - MATLAB (original) (raw)
Main Content
Reset random number stream
Syntax
Description
reset([s](#mw%5Fcb049b5a-4729-41a6-97fd-798b4fd9803c))
resets the generator for the random stream s
to the initial internal state corresponding to its seed. This is similar to clearing s
and recreating it using RandStream, except that reset
does not set the stream'sNormalTransform
, Antithetic
, andFullPrecision
properties to their original values.
reset([s](#mw%5Fcb049b5a-4729-41a6-97fd-798b4fd9803c),[seed](#mw%5F895970df-9c52-48b3-bc35-2ab5d1200cdc))
resets the generator for the random stream s
to the internal state corresponding toseed
(the seed value), and it updates the seed
property of s
. The value of seed
must be an integer between 0 and 232 − 1. Resetting a stream's seed can invalidate independence with other streams.
Note
Resetting a stream should be used primarily for reproducing results.
Examples
Reset Stream to Its Initial State
Reset a random number stream to its initial state. This does not create a random number stream, it simply resets the stream.
stream = RandStream('mt19937ar','Seed',0)
stream =
mt19937ar random stream Seed: 0 NormalTransform: Ziggurat
reset(stream); stream.Seed
Reset Stream Using Specific Seed
Reset a random number stream using a specific seed.
stream = RandStream('mt19937ar','Seed',0)
stream =
mt19937ar random stream Seed: 0 NormalTransform: Ziggurat
reset(stream,1); stream.Seed
Input Arguments
Random number seed, specified as a nonnegative integer. The value ofseed
must be an integer between 0 and 232 − 1.
Version History
Introduced in R2008b