Update – Random Number Generation [RANDBETWEEN]

On October 27, 2010, in Beginners, by stephanie
0

As an update to my previous post on generating random numbers, I have included a reference to the function RANDBETWEEN(a,b).

Thanks to Jason for pointing out this formula.

RANDBETWEEN() Function

Check out the previous post on random number generation, which includes more detail.

Random Number Generator [Calc]

On December 8, 2009, in Beginners, OpenOffice.org Calc, by stephanie
5

A friend of mine is familiar with working in Lotus 1-2-3 and has asked me for some assistance in converting to Excel or OpenOffice Calc. Of course I chose to post my Calc solutions here. :-)

The formula for random number generation is quite easy.

=RAND()

This will get you a random number between zero and 1 (2 decimal places is the default format).

To generate a random number between two values, the formula is modified slightly to:

=RAND()*(b-a) + a
Where b is the higher value and a is the lower value.

Update: You can also use RANDBETWEEN (thanks to Jason):

=RANDBETWEEN(a; b)

For example, to generate a random number between 1 and 100, you would use the following formulae:

=RAND()*(100-1)+1    or
=RANDBETWEEN(1;100)

If you wish this to be a whole number (no decimal places), you can do this in one of two ways.

By Formula

You can modify the formula to include the ROUND function:

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

By Format

You can use the Delete Decimal Place icon on the toolbar and reduce the number of decimal places.

Screenshot-2