close all; clear all; clc;
date_min = datenum([1960 1 1]); % start date
date_max = floor(now); % current date
N = 40;
P = zeros(1,N-1);
for n=2:N
date_r = randi([date_min date_max], 1, n); % random day
date_r_d = datevec(date_r);
d = date_r_d(:,3);
m = date_r_d(:,2);
c = 0;
for i = 1:n
for j = 1:n
if m(i) == m(j) && d(i) == d(j) && i ~= j
c = c + 1;
end
end
end
P(n-1) = c/n;
end
P
Comments
Leave a comment