// Copyright 2016, University of Freiburg,
// Chair of Algorithms and Data Structures.
// Author: Hannah Bast <bast@cs.uni-freiburg.de>.
#include "./BirthdayParadox.h"
// _____________________________________________________________________________
double probabilitySameBirthday(int n) {
// First compute the probability p that all n people have different birthdays.
double p = 1.0;
for (int i = 1; i < n; i++) {
p = p * (365.0 - i)/365.0;
}
return 1 - p;
}