Which of these will give an exactly 50% chance when a random value is a float between 0 and 1 (such as AS3's or JavaScript's Math.random()
)? I have seen both of them used in practice:
if (Math.random() > 0.5) ...
if (Math.random() >= 0.5) ...
Heads up: I'm being pedantic here, because in practice, hitting exactly 0.5
is astronomically low. However, I would still like to know where is the middle of 0 inclusive
and 1 exclusive
.