# rng

Version:

Controls the settings of the random number generator functions rand, randnormal, randi, and randint. rng('default') resets the settings to use the default seed. rng('shuffle') resets the settings to use a random seed. rng(seed) resets the settings to use the specified seed. rng(s) resets the settings to use the specified settings in a structure. You can restore the settings to generate the same random numbers by using rng(s), where s is returned from the previous call of rng.

## Syntax

rng('default')
rng('shuffle')
rng(seed)
rng(s)
s_current = rng
s_previous = rng(...)

## 'default'

Resets the settings to use the default seed.

## 'shuffle'

Resets the settings to use a random seed.

## seed

Resets the settings to use the default seed.

## s

Settings to be reset. The settings are available as a structure.

## ...

Any input, e.g. 'default', 'shuffle', seed, or s.

## s_current

Current settings. The settings are available as a structure.

## s_previous

Settings before the reset. The settings are available as a structure.

rng(999);
s = rng;
a = rand(2);
rng(s);
b = rand(2);

Where This Node Can Run:

Desktop OS: Windows

FPGA: This product does not support FPGA devices