RANDARRAY
Generates a random spilled array of numbers.
RANDARRAY can return decimal values or whole numbers in a specified range.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=RANDARRAY([rows], [columns], [min], [max], [whole_number])
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
rows | number | Optional | 1 |
columns | number | Optional | 1 |
min | number | Optional | 0 |
max | number | Optional | 1 |
whole_number | logical | Optional | false |
Remarks
- Defaults:
rows=1,columns=1,min=0,max=1,whole_number=FALSE. - The function is non-deterministic and recalculates to new values.
- For whole numbers, values are generated in an inclusive integer range.
Error cases
rows <= 0,columns <= 0, or invalid integer bounds return#VALUE!.
Examples
Generate a two-row, three-column array of random decimals.
Formula =RANDARRAY(2,3)
Expected result 2 × 3 array of random numbers
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Generate a two-by-two array of random integers from 10 through 20.
Formula =RANDARRAY(2,2,10,20,TRUE)
Expected result 2 × 2 array of random numbers
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Omit all arguments to request one random value.
Formula =RANDARRAY()
Expected result Random number
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
A random array must contain at least one row.
Formula =RANDARRAY(0,3)
Expected result #VALUE!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Generate six integer dice rolls
Formula =RANDARRAY(6,1,1,6,TRUE)
Expected result 6 × 1 array of random numbers
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
Are RANDARRAY bounds inclusive?
In whole_number mode, min and max are inclusive integer bounds; in decimal mode values are generated over the numeric interval from min toward max.
Why does RANDARRAY recalculate on every recalc pass?
RANDARRAY is volatile and non-deterministic by design, so its spilled results are regenerated each evaluation.