when I key in this formula
=30+10*rand()
I should be getting the real number betwwen 30 ~ 40, but somehow, occasionally, I do get something like 28, 29....
Can anyone give an answer to this?
You must have the original XL 2003. It's the only version of XL that I know of that had a bug in RAND() that generated negative values. [MS changed the RAND() algorithm in 2003 to improve the quality of the generated random numbers.]
Don't use ABS() to "fix" the problem. There's no guarantee the distribution of the random numbers will be uniform. Instead, update your software with the latest set of patches from the MS site.
Edit: I just noticed Andrew's other recommendation to use RANDBETWEEN. Don't. ATP is considered by many as being worse than RAND when it comes to generating r.v.s.
If you are interested in more on the subject search google as well as the google archives of the XL newsgroups for posts by people like Dave Braden, Jerry Lewis, Martin Brown, and Harlan Grove.
when I key in this formula
=30+10*rand()
I should be getting the real number betwwen 30 ~ 40, but somehow, occasionally, I do get something like 28, 29....
Can anyone give an answer to this?
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.