Generating Random numbers.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to generate a set of random numbers. I know there is a way to do this;
I just do not know how to find it. Please help me
 
I need to generate a set of random numbers. I know there is a way
to do this; I just do not know how to find it. Please help me

That depends on your constaints. Generally, to generate random
numbers with a uniform distribution, use the RAND() function in Excel
or the Rnd() function in VBA. If you want randoms integers between A
and B inclusive, again uniformly distributed, you can use the
following formula:

=A + int((B-A)*rand())

Alternativley, you can use RANDBETWEEN(), which is in the Analysis
ToolPak.

However, different techniques may be needed if you want something
other than a uniform distribution.

Moreover, some addition attention is needed if you want to avoid
duplicate random numbers.
 
Errata....

If you want randoms integers between A and B inclusive,
again uniformly distributed, you can use the following formula:
=A + int((B-A)*rand())

I believe that should be either of the following formulas:

=A + round((B-A)*rand(), 0)

=A + int((B-A+1)*rand())
 
Back
Top