randi functions to create sequences of pseudorandom
numbers. Use the
rng function to control the
repeatability of your results. Use the
when you need more advanced control over random number generation.
|Uniformly distributed random numbers|
|Normally distributed random numbers|
|Uniformly distributed pseudorandom integers|
|Control random number generation|
|Random number stream|
This topic introduces random numbers in MATLAB®.
randperm to create arrays of random numbers.
This example shows how to create an array of random floating-point numbers that are drawn from a uniform distribution in a specific interval.
This example shows how to create an array of random integer values that are drawn from a discrete uniform distribution on a specific set of numbers.
This example shows how to create an array of random floating-point numbers that are drawn from a normal distribution having a specified mean and variance.
This example shows how to create random points within the volume of a sphere.
Avoid repetition of random number arrays when MATLAB restarts.
Replace Discouraged Syntaxes of
This example shows how to repeat arrays of random numbers by specifying the seed first. Every time you initialize the generator using the same seed, you always get the same result.
This example shows how to avoid repeating the same random number arrays when MATLAB restarts.
This topic shows how to use the
to control random number generation.
This example uses
create multiple, independent random number streams.
This topic uses
RandStream to create
random number streams and substreams.