def sample(rng, N, k, i):
    """
    Function sampling k indices from the range 0-N without the i index.

    """

    S = set()

    while len(S) < k:
        random_index = rng.randint(0, N - 1)

        if random_index == i:
            continue

        S.add(random_index)

    return list(S)