SpreadJS 13
SpreadJS Documentation / Formula Reference / Formula Functions / RANDARRAY
In This Topic
    RANDARRAY
    In This Topic

    This function returns an array of random numeric values. Users can specify the number of rows and columns, minimum and maximum values and indicate whether to return integers or decimal values.

    Syntax

    RANDARRAY([rows],[columns],[min],[max],[integer])

    Arguments

    RANDARRAY function has the following arguments:

    Argument Description
    rows Specifies the number of rows of random numbers to generate (if nothing is specified, the default value 1 is used).
    columns Specifies the number of columns of random numbers to generate (if nothing is specified, the default value 1 is used).
    min Specifies the minimum of values to generate (if nothing is specified, the default value 0 is used).
    max Specifies the maximum of values to generate (if nothing is specified, the default value 1 is used).
    integer Returns an integer only if the specified value is Boolean TRUE. If this value is FALSE, this function returns a decimal value (if nothing is specified, the default value FALSE is used).

    Data Types

    Accepts the number of rows and columns. Returns an array of random numbers.

    Note: RANDARRAY is a volatile function. This means that each time the worksheet calculates, the RANDARRAY function recalculates the new values.

    Remarks

    By default, if users don't specify the row or column argument, the RANDARRAY function will return a single value between 0 and 1. Also, if minimum and maximum arguments are not specified, then the RANDARRAY function returns a random set of values between 0 and 1. The minimum number argument should always contain a value which is less than the maximum number, else this function will return a #VALUE! error. Further, if the whole-number argument is empty, then this function will choose FALSE as the default value and the decimal value will be returned.

    Examples

    For instance - The cell A8 in the following image contains the formula "=RANDARRAY(5,3)" and returns a random set of values between 0 and 1.

    RANDARRAY function

    RANDARRAY(5,3,1,100) returns a series of random decimal values between 1 and 100.

    RANDARRAY(5,3,1,100,TRUE) returns a series of random whole numbers between 1 and 100.

    Version Available

    This function is available in SpreadJS 13 or later.