RAND function

RAND() RAND()

Returns — Number

A random number between 0 (inclusive) and 1 (exclusive).

Returns a random number between 0 (inclusive) and 1 (exclusive). RANDBETWEEN allows you to choose the end points of the interval, while RANDARRAY returns an array of random numbers.

Examples

RAND()RAND()

Returns a random number between 0 (inclusive) and 1 (exclusive).

{ RAND(), RAND(), RAND() }{ RAND(); RAND(); RAND() }

Returns an array of three random numbers between 0 (inclusive) and 1 (exclusive).

Returns an array of three random numbers between 0 (inclusive) and 1 (exclusive).

RAND() * 10 + 5RAND() * 10 + 5

Returns a random decimal number between 5 (inclusive) and 15 (exclusive).

RANDBETWEEN(5, 15)RANDBETWEEN(5; 15)

Returns a random integer (whole number) between 5 (inclusive) and 15 (inclusive).

INDEX(RANDARRAY(1, 5, 15, TRUE), 1)INDEX(RANDARRAY(1; 5; 15; TRUE); 1)

Returns a random integer (whole number) between 5 (inclusive) and 15 (inclusive). This formula runs somewhat slower than the RANDBETWEEN example, due to the need to create an intermediary array with a single element.