Random generalized extreme value (GEV) variates.

def rgev(xi, mu=0, sigma=1, size=None):
    """
    Random generalized extreme value (GEV) variates.
    """

    q = np.random.uniform(size=size)
    z = flib.gev_ppf(q, xi)
    return z * sigma + mu