Consider a stick of length 1. Pick two points uniformly at random on the stick, and break the stick at those points. What is the probability that the three segments obtained in this way form a triangle?
I have implemented two versions. Version 1 works correctly, but version 2 doesn't. How can I fix the second version?
Version 1
Module[{min, max},
{min, max} = {Min@#, Max@#} & /@ RandomReal[1, {10^5, 2}] // Transpose;
Mean@MapThread[
Function[{x, y, z}, N@Boole[x + y > z && x + z > y && y + z > x]],
{min, max - min, 1 - max}]]
Version 2
Block[{t1, t2, t3},
t1 = {x > 0, y > 0, x + y < 1};
t2 = {x + y > z, x + z > y, y + z > x} /. z -> 1 - x - y;
Print[t3 = And @@ t1 ~ Join ~ t2 // FullSimplify];
Probability[t3,
Distributed[x, UniformDistribution[{0, 1}]] &&
Distributed[y, UniformDistribution[{0, 1}]]]]