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

5 lines
189 B
Mathematica
Raw Normal View History

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