def minmax(x, y, rnd_feature_idxs):
    """
    Calculates the pairwise "minmax" distance between
    two vectors, but limited to the `rnd_feature_idxs`
    specified. Note that this function is symmetric,
    so that `minmax(x, y) = minmax(y, x)`.

    Parameters
    ----------
    x: float array
        The first vector of the vector pair.
    y: float array
        The second vector of the vector pair.
    rnd_feature_idxs: int array
        The list of indexes along which the distance
        has to be calculated (useful for bootstrapping).

    Returns
    ----------
    float: minmax(x, y)
    """

    mins, maxs = 0.0, 0.0
    a, b = 0.0, 0.0

    for i in rnd_feature_idxs:

        a, b = x[i], y[i]

        if a >= b:
            maxs += a
            mins += b
        else:
            maxs += b
            mins += a

    return 1.0 - (mins / (maxs + 1e-6))