public static double probability(final double p) {
		if (p < 0.0 || p > 1.0) {
			throw new IllegalArgumentException(format(
				"The given probability is not in the range [0, 1]: %f", p
			));
		}
		return p;
	}
Check if the given double value is within the closed range {@code [0, 1]}.

@param p the probability to check.
@return p if it is a valid probability.
@throws IllegalArgumentException if {@code p} is not a valid probability.
jenetics/src/main/java/io/jenetics/internal/util/Requires.java