# How to Build a Random Number Generator in Google Sheets

A collection of random numbers is often required. Writing random numbers manually into a group of cells, whether to produce sample data or to test a script, may be time-consuming and tiresome. This is where Google Sheets’ RAND function kicks in. It gives you the ability to produce a random number using a simple formula.

This post will go through how to accomplish it in your spreadsheets in detail. Continue reading to learn how to generate random numbers in Google Sheets.

## The RAND and the RANDBETWEEN Function

The RAND formula provides a random decimal number between 0 and 1, which is why you may use it in your spreadsheet as a random number generator. The RAND function has the following syntax:

=RAND()

There are no arguments in the formula. The formula will return the #N/A error if anything is typed within the bracket.

Because the RAND function is volatile, it recalculates the result whenever you make a modification to the spreadsheet or reload the Google Sheets tab. Because the function recalculates each time, it might create slowdowns, particularly if the formula is used often.

The RANDBETWEEN function may also be used with the following syntax:

=RANDBETWEEN(lower, upper)

The formula has two arguments:

- lower – This integer represents the range’s lower limit. The produced random number will be equal to or greater than this parameter.
- higher – This integer indicates the range’s upper limit. The generated random number will be equal to or less than this parameter.

Remember that, like RANDBETWEEN in Excel, each of these parameters must include an integer, which may be either the address or value of a cell. Remember that the lower integer must be smaller than the higher number.

### Differences Between RAND and RANDBETWEEN

Here are a few differences between the RAND and RANDBETWEEN functions to assist you distinguish between them:

- The RANDBETWEEN function is less likely to produce unique random numbers with smaller ranges than the RAND function.
- The RAND function returns decimal values, while the RANDBETWEEN function returns integer values.
- The RAND function does not take any arguments, meaning the brackets are left empty. RANDBETWEEN, on the other hand, takes two arguments: the upper and lower limit.
- RAND can generate any number between 0 and 1, while RANDBETWEEN can generate a random number between user-defined limits.

## Random Number Generator Between Two Values

A smart use of the RAND algorithm is required to generate a random number between two values. Let’s start with X and Y as the top and bottom bounds. Keeping this in mind, the formula goes as follows:

=RAND() * (X - Y) + Y

Assuming you have the numbers 100 and 1, here is how the formula will appear in action:

=RAND() * (100-1) + 1

You may also use the RANDBETWEEN function for the same purpose. The formula is easy to apply. The upper and lower limits must be written within the formula using the correct syntax. In this example, we will enter the upper and lower boundaries as well as the formula’s cell address into the spreadsheet.

Here are the steps you need to follow to do this:

- Inside their corresponding cells, write the top and lower limits. It makes no difference where the cell is located. As long as we write the addresses in the formula correctly, the output should be acceptable.
- Enter the =RANDBETWEEN (formula. Enter the lowest and higher limits separately, separated by a comma. Finish it off with a closing bracket.
- Finally, hit the Enter key to run the formula. A random number between the higher and lower limits should occur.
- You may use the autofill option or click on the cell holding the formula, then touch and drag down the blue dot at the bottom right of the chosen cell to produce the random number for two additional cells in the column.

## Create an Array of Random Numbers

You may also use the RANDARRAY function in your spreadsheet to generate a random number array. ARRAY functions are useful Google Sheets hacks that enable you to apply formulae in bulk. The formula’s syntax is as follows:

=RANDARRAY(row, column)

The formula has two optional arguments:

- row – The number of rows to show, chosen at random. If you supply a value in the column argument, this argument is required.
- column – The number of columns to be shown at random.

If you want to make an array of random integers, follow these steps:

- Choose the cell where you want to run the formula.
- Begin by typing =RANDARRAY(Enter the number of rows and columns separated by a comma.
- Finish the formula with a closing bracket.
- To run the formula, press Enter.

## Changing the Refresh Rate for Volatile Functions

Both the RANDBETWEEN and RAND functions are volatile, which means that the numbers produced by the two functions do not remain constant. When the sheet is changed or the page is refreshed, a new value is computed.

You may, however, modify the recalculation values to better fit your requirements. Follow these steps to do this:

- On the top bar, choose File. This will activate a dropdown menu. There, choose Settings.
- Click Calculation in the window that appears to open a new tab where you may adjust the recalculation parameters.
- Select the Recalculation option. This will bring up a dropdown menu with many alternatives.
- Choose the one that best matches your needs.
- To save the changes, click on Save settings.

## Wrapping Up the Random Number Generator in Google Sheets

In Google Sheets, you may produce a random number using the RAND, RANDBETWEEN, and RANDARRAY functions. If you require random numbers in your spreadsheets, this may be quite useful.

You are looking for information, articles, knowledge about the topic **How to Build a Random Number Generator in Google Sheets** on internet, you do not find the information you need! Here are the best content compiled and compiled by the achindutemple.org team, along with other related topics such as: Google.