Because replacement=True, so it will return the same sample probably.
With replacement=False, RandomSampler will go through the whole dataset.
If you want to specify the number of samples. You could have a try on SubsetRandomSampler.