Wednesday, December 19, 2012

The RAND Function & Excel Slot Machine


It’s time for a little review and some Fun! Let’s look at the fascinating RAND function. This intriguing and useful function returns a Random Number that is Greater Than or Equal to 0 and Less Than 1. Each time your worksheet recalculates, (by reopening or forced recalculation by pressing F9), the RAND function returns a New Random Number.

It should be noted that some hard core statisticians have voiced concerns about the true Randomness of the RAND function (it is prone to sequential correlations if large runs of numbers are taken), but it suffices for nearly all but the most demanding statistical applications, and if fine for us mere mortals.

The Syntax for the Rand function is simply:

RAND( )

If you want to create a random number between two numbers, (where a is the smallest number and b is the largest number), you can use the following:

=RAND()*(b-a)+a

If you want only Whole Numbers you can use:

RANDBETWEEN()

For example, =RANDBETWEEN(1, 500) will produce a Random Whole Number between 1 and 500.

There are countless statistical applications, of course, but you can also use it in some entertaining applications. For example, some Excel Enthusiasts have used it to create Tetris-style and Dice-Rolling games in Excel.

I have used the RAND function in conjunction with other functions and graphics to create a Slot Machine in Excel (send me a request at excelenthusiast@gmail.com if you would like a copy of the Slot Machine spreadsheet). I will be happy to send a copy to you.

The RAND function. Great for use in statistical applications, building games, slot machines, and other Fun Stuff!

Cheers!

No comments: