Question: Probability of a situation occurance

I'm drawing a complete blank on this. 

The probability of a branch breaking in a particular tree as someone climbs is 2%.  After the person has climbed over 40 branches, did any of them break?  I'm trying to set that up as a simulation in Maple but I'm not sure about how to do it. 


I guess if I generate a random number and it falls under .02 it breaks, is that how I determine that?

randomize():

n := 0;
for i to 40 do
ran := evalf(rand()*10^(-12));
if ran < 0.2e-1 then n := n+1: end if:
end do:
print("Branch broke", n, "times")

I'm not sure I've got the probability right.

 

Please Wait...