def ab_from_mv(m, v):
    """
    estimate beta parameters (a,b) from given mean and variance;
    return (a,b).

    Note, for uniform distribution on [0,1], (m,v)=(0.5,1/12)
    """
    phi = m*(1-m)/v - 1  # z = 2 for uniform distribution
    return (phi*m, phi*(1-m))