function [ r ] = gera_aleatorio( prob, N )

for k=1:N
    a = rand(1);
    for j=1:length(prob)
        if a <= sum( prob(1:j) )
            r(k) = j;
            break
        end
    end
end