Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Random Number Generator

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.)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Random Number Generator

Hi Brad,

Try using the formula

=RANDBETWEEN(1,10)

Enable this formula via
Tools - Addins - Analysis Toolpak

Cheers

Dav

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default Random Number Generator

Yes, that approach is fine.

Jerry

Brad wrote:

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.)


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Random Number Generator

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

"Brad" wrote in message ...
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.)
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default Random Number Generator

For a random number between a and b inclusive, I use:

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

--

Brad wrote in message ...
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.)

--

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Random number Generator RayT New Users to Excel 14 January 15th 08 11:16 PM
Random number generator deelee Excel Worksheet Functions 3 October 12th 06 07:46 PM
random number generator Barb Excel Discussion (Misc queries) 2 September 22nd 06 11:12 PM
Random Number Generator Pascale Excel Worksheet Functions 3 July 9th 05 12:37 AM
random number generator Jose Luis Excel Discussion (Misc queries) 1 June 14th 05 09:41 PM


All times are GMT +1. The time now is 08:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright İ2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"