import random


def random_class_ids(lower, upper):
    """
    Get two random integers that are not equal.
    Note: In some cases (such as there being only one sample of a class) there may be an endless loop here. This
    will only happen on fairly exotic datasets though. May have to address in future.
    :param lower: Lower limit inclusive of the random integer.
    :param upper: Upper limit inclusive of the random integer. Need to use -1 for random indices.
    :return: Tuple of (integer, integer)
    """
    int_1 = random.randint(lower, upper)
    int_2 = random.randint(lower, upper)
    while int_1 == int_2:
      int_1 = random.randint(lower, upper)
      int_2 = random.randint(lower, upper)
    return int_1, int_2