%% Control Random Number Generation
% Save the current state of the random number generator and create a random permutation of the integers from 1 to 8.

s = rng;
r = randperm(8)

% Restore the state of the random number generator to s, and then create a new random permutation of the integers from 1 to 8. The permutation is the same as before.

rng(s)
r1 = randperm(8)

% You can use the rng function to specify the settings of the random number generator.
%
% Copyright 2019 The MathWorks, Inc.