I am trying to generate multiple random unsigned integers between two varying (very small) unsigned integer values (maximum and minimum vary between 1 and 6 really). I would like to bias the generator towards the middle of the range.
I have tried using the Normal distribution from the rand_dist crate (here is a rust playground for it) it seems to be for floats and unbounded beyond probability, i.e. I want values between 2 and 5 but i can potentially get a result like 0.81 or 6.92 even if they are rather rare. I wasn't able to find an integer version of the Normal distribution in the documentation. I am assuming it does not exist.
I would also like this to be efficient so I have a feeling the normal distribution for floats would not be very performant. I've also noticed a distribution called weighted indexes but this would require manual computation of weights with every iteration.
Perhaps the regular get_range for integer values can be biased towards the mean arithmetcally somehow after the generator runs. Does anyone have any interesting solutions for this?
Aucun commentaire:
Enregistrer un commentaire