Skip to main content
Mail a PDF copy of this page to:
(Your email address will not be added to a mailing list)
Show menu Show menu

RAND function


Random number function (uniform distribution). RAND(x) returns a computer-generated random number:

(a) when x < 1 then the result is a number between 0 and 1, or

(b) when x > 1 then the result is a whole number between 1 and x (inclusive).

The argument x can be a real number, or a matrix. When it is a matrix, the function returns a matrix with the same dimensions and with the RAND function applied to all elements.


RAND(10) can return 4 or any other whole number ranging from 1 to 10.

RAND(1) can return 0.8755 or any other number between 0 and 1.



Related functions