# n: number of randomly selected elements
# N: number of elements on the set from which elements are selected
function p = birthday(n,N)
# we need to choose at least two elements
if n < 2
p = 0;
else
pc = 1.0;
for i = 1:(n-1)
pc = pc * (N-i)/N;
end
p = 1 - pc;
end
end