def cdf(vals, reverse=False):
    """Computes the CDF of a list of values"""
    vals = sorted(vals, reverse=reverse)
    tot = float(len(vals))
    x = []
    y = []

    for i, x2 in enumerate(vals):
        x.append(x2)
        y.append((i+1) / tot)

    return x, y