import math


def binary_entropy(p):
    """
    Uses the binary entropy function denoted H(p) in information theory/statistics
    Computes the entropy of a Bernoulli process with probability of success p

    When p = .5, entropy is at its max value (unbiased bit, most common unit of information entropy)

    @param {float} p = probability of success p
    @return {float}
    """
    return -p * math.log(p,2) - (1 - p) * math.log(1-p, 2)