rand
Uniformly distributed random numbers in [0, 1].
Syntax
Section titled “Syntax”r = randr = rand(n)r = rand(m, n)r = rand(d1, d2, d3, ...)Description
Section titled “Description”Returns pseudorandom values drawn from the uniform distribution on [0, 1]. With no arguments, returns a single scalar. With dimensions, returns an array of the requested shape. Uses MathJet’s interpreter-shared PRNG state.
Examples
Section titled “Examples”rand % e.g. 0.4321rand(3) % 3×3 uniform random matrixrand(1, 100) % row vector of 100 samples