Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

rand (RandStream) - Uniformly distributed random numbers

Class

@RandStream

Syntax

r = rand(s,n)
rand(s,m,n)
rand(s,[m,n])
rand(s,m,n,p,...)
rand(s,[m,n,p,...])
rand(s)
rand(s,size(A))
r = rand(..., 'double')
r = rand(..., 'single')

Description

r = rand(s,n) returns an n-by-n matrix containing pseudorandom values drawn from the standard uniform distribution on the open interval (0,1). The values are drawn from the random stream s. rand(s,m,n) or rand(s,[m,n]) returns an m-by-n matrix. rand(s,m,n,p,...) or rand(s,[m,n,p,...]) returns an m-by-n-by-p-by-... array. rand(s) returns a scalar. rand(s,size(A)) returns an array the same size as A.

r = rand(..., 'double') or r = rand(..., 'single') returns an array of uniform values of the specified class.

The sequence of numbers produced by rand is determined by the internal state of the random number stream s. Resetting that stream to the same fixed state allows computations to be repeated. Setting the stream to different states leads to unique computations, however, it does not improve any statistical properties.

See Also

rand, @RandStream, randi (RandStream), randn (RandStream), randperm (RandStream)

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS