Thanks for the reply. I understand that due to the randomness the sampling is not perfectly uniform.
But I would not expect these results:
list(WeightedRandomSampler([0.3, 0.3, 0.3], 100000, replacement=True)).count(0)
Out[5]: 33548
list(WeightedRandomSampler([0.3, 0.3, 0.3], 100000, replacement=True)).count(1)
Out[6]: 33101
list(WeightedRandomSampler([0.3, 0.3, 0.3], 100000, replacement=True)).count(2)
Out[7]: 33176

Is there a way to make this more uniform?