It's because of precision.
This is totaly normal, and you never should equated floating type.
This is good article why is that
http://www.cygnus-software.com/papers/co...floats.htm
or more futher -
http://docs.oracle.com/cd/E19957-01/806-...dberg.html
You should remember that float has an approximate value.
Also chance that RandomF give you excatly max value (if using 32-bit randomizer) is 1 to 2^32 what is 1 to 4294967296.
I'm not good at english, so I try to picture it:
if float type would have one number after point - RandomF(1,2) give you back one of this:
1.0 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6 | 1.7 | 1.8 | 1.9 | 2.0
As you see chance to get 2.0 is 1 to 11
if float would have two number after point - RandomF(1,2) give you back:
1.00 | 1.01 | 1.02 ....... | 1.97 | 1.98 | 1.99 | 2.00
Now, chance to get excatly 2.00 is 1 to 101
Now try imagine that with 32-bit float in c++ randomF(1,2) give you something from
1.000000000000000 to 2.000000000000000
I hope it's not mutter to you since I'm not good with explain things.