What’s the best way to select an enum variant according to a non uniform probability?
I have an enum and I want to create instances of its variants by performing a random non uniform extraction. A possible solution involves using Rng::gen_range()
from rand
by trying to match the desired probabilities to the subranges that are assigned to each variant.