Random Number Generator

  • Thread starter Thread starter Brad
  • Start date Start date
B

Brad

I¹m aware of the function ³=RAND()², that produces the numbers between 0 and
1, but I¹m just trying to create a cell formula that produces an evenly
distributed number between two arbitrary values ....

Assuming I need between 1 and 10 (i.e., 1,2,3,4,5,6,7,8,9 or 10), how would
I achieve this without getting a skewed result?

I was thinking of =TRUNC((RAND()*10+1),0) ? Now that¹s just for between 1
and 10

Is there a better way of doing this ­ help!

Brad.)
 
Hi Brad,

Try using the formula

=RANDBETWEEN(1,10)

Enable this formula via
Tools - Addins - Analysis Toolpak

Cheers

Dav
 
Random Number GeneratorTo Add:

Just change the 1 and 10 to reflect the start number and the breadth/width of the range you want to generate

=Trunc(rand()*(end-begin+1)+begin)

As an example:

If i wanted to generate Uppercase letters between A and Z

code("A") = 65
code("Z") = 90
want to generate possible 26 letters starting with 65 (generate integers between 65 and 90 inclusive)

=Char(Trunc(rand()*26+65)

or
=Char(Trunc(rand()*(90-65+1)+65))

or without having to figure it out:
=CHAR(TRUNC(RAND()*(CODE("Z")-CODE("A")+1)+CODE("A")))




--
Regards,
Tom Ogilvy

I'm aware of the function "=RAND()", that produces the numbers between 0 and 1, but I'm just trying to create a cell formula that produces an evenly distributed number between two arbitrary values ....

Assuming I need between 1 and 10 (i.e., 1,2,3,4,5,6,7,8,9 or 10), how would I achieve this without getting a skewed result?

I was thinking of =TRUNC((RAND()*10+1),0) ? Now that's just for between 1 and 10

Is there a better way of doing this - help!

Brad.)
 
Back
Top