RANDARRAY
The RANDARRAY function generates an array of random numbers between 0 and 1. It is useful for creating datasets for simulation or testing. You can also use it to randomly populate cells in Excel.
Syntax 🔗
=RANDARRAY(rows
, columns
, [min]
, [max]
, [integer]
)
rows | The number of rows in the array. |
columns | The number of columns in the array. |
min (Optional) | The minimum value for the random numbers. Defaults to 0 if omitted. |
max (Optional) | The maximum value for the random numbers. Defaults to 1 if omitted. |
integer (Optional) | A logical value that specifies whether to generate integers. Defaults to FALSE if omitted. |
About RANDARRAY 🔗
Use the RANDARRAY function in Excel to quickly fill a range of cells with random numbers. With this function, you can specify the dimensions and characteristics of the array you want to create. This is useful for tasks like data analysis, simulations, or any situation where you need random numbers within a specific range and format. You can adjust the optional parameters to customize the range and type of random numbers, allowing for flexibility and precision in your work.
Examples 🔗
To generate a 3x3 array of random numbers between 0 and 1, use the formula: =RANDARRAY(3, 3)
For a 2x4 array of random integers between 10 and 100, use: =RANDARRAY(2, 4, 10, 100, TRUE)
Notes 🔗
The RANDARRAY function updates each time the worksheet recalculates or changes. To keep random numbers constant, use copy-paste values or another method to freeze them.
Questions 🔗
The RANDARRAY function uses the Mersenne Twister algorithm to produce pseudorandom numbers within the specified range. Each invocation of RANDARRAY generates a fresh set of random numbers based on the current state of the random number generator.
Can I specify both min and max values for the generated random numbers?Yes, you can specify both the minimum and maximum values for the random numbers using the min
and max
arguments. This allows you to control the range within which the random numbers will be generated.
To generate random integers instead of decimal numbers, you can set the integer
argument to TRUE. This instructs the function to produce whole numbers within the specified range, useful for scenarios that require integer values.