I have a follow up on the effect of INT and ROUND on the true randomness.
Stats is not a strength so please bear with me.
but please comment back
I am happy with the general formula as posted
=RAND()*(b-a)+a
Where a = minimum limit
And b = maximum limit
and have a gut feeling that the distribution of values remains as random
as the original RAND() function <g>
if you need integer values and use ROUND
eg. =ROUND(RAND()*(b-a)+a)
I think the probability of the numbers (a-1) through to (b+1) is equal
as they will be returned for numbers <+0.5 above AND >=0.5 below
ie the same span.
Howevere the possibility of returning a or b is approx half that of the
others as
a will be returned for numbers <=a AND >=(a-0.5)
b will be returned for numbers <(b+0.5) AND >=b
both are not precisely the same span but approx half that of all other
numbers
If I follow the same logic for the INT function with RagDyeR's modified formula
=INT(RAND()*(b+1-a)+a)
because as he states correctly
This change insures that the maximum limit has the *possibility* of being
returned.
I believe the probability of returning a particular integer is now equal
for all numbers in the range.
eg. range of values that return N is <(N+1) AND >=N
The other function that could be used but probably should be avoided is
TRUNC as this will give 'funky' results if the range crosses through zero.
In conclusion I believe the correct way to go is
=INT(RAND()*(b+1-a)+a)
Where a = minimum limit
And b = maximum limit
What do you all think?
cheers RES