Generating Random Numbers is a very important technique and is gaining popularity. It is one of the most used but often overlooked skill. Random numbers are required in various applications such as:

- Monte Carlo simulations
- Statistical sampling and analysis
- Sampling for machine learning and data analysis
- Testing and debugging of algorithms
- Gaming and gambling simulations
- Creating randomized data sets
- Cryptographic applications.

Now lets see some of the ways to use excel to generate random numbers. First we will look at the old fashioned ways and then more to a new recent technique released by Microsoft.

## 1) RAND function

Let’s see our function function which is RAND(). The excel function RAND() do not take any input argument and generate a random number between 0 and 1.

As you can see above, we have random numbers generated. Now if you want to get a different set of numbers from this, then the function will refresh every time you enter something in some other cells or press **F9. **The most likely distribution it will generate is a uniform distribution but since it is random, it may take either right skewed or left skewed distribution.

## 2) RANDBETWEEN function

Now let’s see our second function , RANDBETWEEN(botton, top) is used for generating integer random numbers. The function takes 2 arguments `bottom` which represents the least integer number to take and `top` represents the largest integer to take.

The generated random number will be

## 3) RANDARRAY function (Only for Excel 365)

Finally, we will see this amazing new function . This is an additional function in MS Excel 365 based on Dynamic Array engine. The function can take 5 arguments and all of them are optional. The following table shows each of them. I found this function interesting. Check out on Microsoft’s website.

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

Argument | Explanation |

rows | Number of rows required |

columns | Number of columns required |

min | Minimum Number |

max | Maximum Number |

integer | Whether Integer or Decimal Numbers If 0 then decimal numbers, if 1 then integer numbers |

As you can see that RANDARRAY() is a dynamic array function and generate spill over the cells.

To conclude I can say that although RANDARRAY() is a new function and is definitely a powerful one, but if you don’t have MS 365 then don’t worry, you can use the same function in Google Sheets. To check how to do it, follow this like. **“How to use RANDARRAY() in Google Sheets“**

Thats all for now. If you want to learn about programming in R language consider checking out this blog post.