randn
R2026bNormally distributed random numbers
Syntax
Description
returns a random scalar drawn from
the standard normal distribution.X = randn
returns an X = randn(sz1,...,szN)sz1-by-...-by-szN array of random numbers
where sz1,...,szN indicate the size of each dimension. For example,
randn(3,4) returns a 3-by-4 matrix.
generates numbers from random number stream X = randn(s,___)s instead of the default
global stream. To create a stream, use RandStream. You
can specify s followed by any of the input argument combinations in
previous syntaxes.
Examples
Input Arguments
Output Arguments
More About
Tips
The sequence of numbers produced by
randnis determined by the internal settings of the uniform pseudorandom number generator that underliesrand,randi,randn, andrandperm. You can control this shared generator using therngfunction, which applies the default normal transformation algorithm for the selected generator. For greater control over generating normally distributed random numbers, such as selecting a different normal transformation algorithm, you can use aRandStreamobject as the random number stream forrandn.
Extended Capabilities
Version History
Introduced before R2006aSee Also
randi | rand | rng | RandStream | sprand | sprandn | randperm
Topics
- Create Arrays of Random Numbers
- Control Random Number Generation
- Random Numbers Within a Specific Range
- Random Numbers from Normal Distribution with Specific Mean and Variance
- Random Numbers and Vectors from Multivariate Normal Distributions
- Class Support for Array-Creation Functions
- Why Do Random Numbers Repeat After Startup?