How does WeightedRandomSampler work?

your understanding may be correct,pls reference here ,perhps it helps.