public static double binomial(double p, int n, int k) {
		if (k < 0 || n < 0) throw new IllegalArgumentException("\nn and k must be greater than or equal to zero");
		if (k > n) throw new IllegalArgumentException("\nk is greater than n");
		return Math.floor(0.5D + Math.exp(Stat.logFactorial(n) - Stat.logFactorial(k) - Stat.logFactorial(n - k))) * Math.pow(p, k) * Math.pow(1.0D - p, n - k);
	}