2.1 Random Samples

The one you will find most convenient for our labs is the function RANDBETWEENN(bottom,top), which Returns a random integer number between the numbers specified in the function’s arguments. The other random functions are RAND(), which returns an evenly distributed random real number greater than or equal to 0 and less than 1, and RANDARRAY(rows,columns,min,max,integer), which Returns an array of random numbers. For RANDARRAY, you can specify the number of rows and columns to fill, minimum and maximum values, and whether to return whole numbers or decimal values.

We focus now on the RANDBETWEEN function.

2.1.1 Insert the function RANDBETWEEN on a PC

To use RANDBETWEEN, select a cell in the active worksheet. Click in the formula tab and then click the Insert Function ribbon.

The Insert Function ribbon is depicted.

Figure 2.1: Insert Function ribbon.

Select the category All in the dialog window. Then select RANDBETWEEN and then fill in the bottom and top numbers. Returns a random integer number between the numbers you specify.

The dialog box of the Insert Function in Excel on a PC.

Figure 2.2: The dialog window of Insert Function on PC.

2.1.2 Insert the function RANDBETWEEN on a MAC

  1. Click on the Formula tab.
  2. Click the Insert Function ribbon.
  3. You will see on the right side of the Excel window that the Formula Builder appears.
  4. In the search box, start to type a keyword for the function you are looking for. Excel will list functions that match the criteria of the search you type.
  5. Then select the function you wish to insert in the worksheet. In this case, the RANDBETWEEN function.
  6. Adjust the arguments of the formula (top and bottom numbers) as needed.
The dialog box of the Insert Function in Excel on a MAC.

Figure 2.3: Dialog window of Insert Function on MAC.

Note: Alternatively, you can simply type =RANDBETWEEN(bottom,top) in the formula bar, with numbers in place of bottom and top for the arguments of the formula.