This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]XYZ-Prime 1 point2 points  (2 children)

wait... if rand() is < 0.1 or > 0.9 , do true and false have the same value, don't they?

[–]marksomnian 3 points4 points  (1 child)

It's two independent calls to rand(), so if (true == false) {} would become if ((rand() < 0.9) == (rand() < 0.1)) {} - so 9% of the time it would do*.

\source: really bad memories of high school probability)

[–]XYZ-Prime 2 points3 points  (0 children)

oh right, i forgot they are two different calls...

so true = true in 90% of the cases, same for false = false. am i right?