%% Reset a Random Number Stream
% Create a random number stream whose seed is three. Use the stream to generate eight random numbers.

stream = RandStream('dsfmt19937','Seed',3);
z = rand(stream,1,8)

% Reset the random number stream to its initial state with seed equal to three. Reproduce the eight random numbers that were generated.

reset(stream,3);
z = rand(stream,1,8)

% Resetting a stream's seed can invalidate independence with other streams. Only reset a stream to reproduce results from the stream.
%
% Copyright 2020 The MathWorks, Inc.