uaveiro-leci/3ano/1semestre/mpei/aula02/part1/CalculateProbMinEq.m

5 lines
189 B
Mathematica
Raw Normal View History

function P = CalculateProbMinEq(partial, total, experiences)
results = rand(total, experiences) > 0.5;
successes = sum(results) >= partial;
P = sum(successes) / experiences;
end