def swap(array, idx_x, idx_y):
    """
    Swap two values within an array. Mutates array!

    :param array: array
    :type array: list[any]
    :param idx_x: index of a value
    :type idx_x: int
    :param idx_y: index of another value
    :type idx_y: int
    :return: array with swapped elements
    """
    temp = array[idx_x]
    array[idx_x] = array[idx_y]
    array[idx_y] = temp
    return array