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

RAND function

Description

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.

Examples

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.

Calculator

RAND(  

Related functions