tallrng
Control random number generation for tall arrays
Syntax
Description
tallrng("default")
restores the settings of the random
number generator used in tall array calculations to their default values. The
random numbers produced are the same as if you restart MATLAB®.
tallrng("shuffle")
specifies the seed of the random
number generator based on the current time. Use this syntax when you want
different sequences of random numbers each time they are generated.
tallrng(
specifies the starting
point, or seed, of the random number generator. Use this syntax when you want to
produce predictable sequences of numbers.seed
)
tallrng(
specifies the
algorithm for the random number generator to use with a seed of 0. This syntax
is equivalent to generator
)tallrng(0,generator)
. (since R2023b)
returns the current
state of the random number generator as a structure. Use the structure to
restore the random number generator to the captured state at a later time with
state
= tallrngtallrng(state)
.
tallrng(
restores the state of
the random number generator using settings previously captured with
state
)state = tallrng
.
Note
The default algorithm and seed for the random number generator in the
MATLAB
Preferences window only affect
rng("default")
and do not affect calls to
tallrng("default)
.
Examples
Input Arguments
Output Arguments
Tips
If you have Statistics and Machine Learning Toolbox™, then
tallrng
controls the random numbers that functions such asdatasample
,cvpartition
, andTreeBagger
generate during tall array calculations.