%Initial parameters for simulation
NumberSim=10000; %Number of simulations
NumberWD=31; %Amount of days in the month
k=0;
Average=ones(31,31);%Resulting matrix
for i=1:31
    for j=1:31
        for s=1:NumberSim
            if Probabilityofsuc(i,j)<rand(1)%Generation of random probabilites
                k=k+NumberWD;
            end
        end
        Average(i,j)=k/NumberSim;
        k=0;
    end
end