<< randn random

rng


Random Number Generator.


Syntax


lst = rng('enginelist')
rng('default')
s = rng('default')
rng('shuffle')
s = rng('shuffle')
rng(seed)
s = rng(seed)
rng(seed, generator)
s = rng(seed, generator)
rng('shuffle', generator)
s = rng('shuffle', generator)
s = rng
rng(s)

Input argument


seed

an integer value: new seed for random generator

generator

a string: 'twister', 'twister64', 'laggedfibonacci607'

s

a struct

Output argument


lst

a cell of strings.

s

a struct

Description


lst = rng('enginelist') returns the list of available random number generator.

rng('default') puts the settings of the random number generator to default values.

s = rng('default') puts the settings of the random number generator to default values.

rng('shuffle') puts the settings of the random number generator to default values and returns previous generator as an struct.

s = rng('shuffle') seeds the random number generator based on the current time.

rng(seed) seeds the random number generator using the nonnegative integer.

s = rng(seed) seeds the random number generator using the nonnegative integer and returns previous generator as an struct.

rng(seed, generator) seeds the random number generator using the nonnegative integer and specify also the type of generator used.

s = rng(seed, generator) seeds the random number generator using the nonnegative integer and specify also the type of generator used and returns previous generator as an struct.

rng('shuffle', generator) seeds the random number generator based on the current time and specify also the type of generator used.

s = rng('shuffle', generator) seeds the random number generator based on the current time,specify also the type of generator used and returns previous generator as an struct.

s = rng returns current generator as an struct.

rng(s) restores the settings of the random number generator using a previous struct returned by s = rng.

Example


rng('default');
r = rng()
lst = rng('enginelist')

See also


rand, randn.

History


Version Description
1.0.0 initial version

Author


Allan CORNET

<< randn random