The sampler is responsible for the creation of the indices.
As long as you don’t use a sampler which samples with replacement, the indices won’t be repeated.
You can add print("index ", index) into the __getitem__ method and see that each index is unique for the current example.