Coding challenge

Suppose you have a stick with a length of 1 (m, foot, yard, etc.). If you break the stick in 2 random places, what is the probability that you can make a triangle out of the 3 resulting pieces? Write some code that uses random numbers (math.random()) to find the two break points. Then use the triangle inequality (see Wikipedia) and many, many trials, to find the probability. (Ans: 0.25).

Type your code here:

Lua reference

See your results here:

Show a friend, family member, or teacher what you've done!

Here is a share link to your code: