Hello,
I would know why you use this formula "INT(RAND()*5)+8" instead of "RANDBETWEEN(8,12)" as you do within the course.
If rand gives you 1 you obtain 13 but the max value in the example it's supposed to be 12 isnt't it?.
Thanks for your help.
Stefano
Hi Stefano
Great question.
=RANDBETWEEN(8,12) will give you the same answer as =INT(RAND()*5)+8. The reason you will not get 13 out of INT(RAND()*5)+8 is that RAND() generates values between 0 and 1 – but in reality the Random Number Generator will never have a 0 or a 1. It will start as 0.000000…1 and end at 0.9999999…999. The highest value (RAND()*5) will get is 4.99999…999 and the INT(RAND()*5) will be 4 resulting in 12 when you add the 8.
I did not use the easier RANDBETWEEN(8,12) function is simple to understand. I used the more complex function so that the workshop participants will be able to master the more complex distributions, like the continuous Uniform distribution (return on investment between 10,000 and 20,000 dollars =RAND()*10000+10000) or a Normal distribution (for example 20,000 with a standard deviation of 600 =NORM.INV(RAND(),20000,600) .
Once you understand the more complex formula – you can apply it better to real life applications.
Isaac