mercredi 28 octobre 2020

Python weighted random number within range

I am trying to write a function that will generate a weighted random number. Simply put, I have two ranges, and one of them falls within the other. In x% of the cases, the number should fall within the inner range, but in y%, it should be outside of that but within the outer range.

Generating weighted random numbers I found this question about weighted random numbers, but this results in a number picked from a list of options and not a random number within a range. Is it possible to do so?




Aucun commentaire:

Enregistrer un commentaire