I'm creating a Java application that needs to randomly generate numbers with probabilities. These float
numbers (or doubles
doesn't change much) must be from 0 to 100 where 0 and 100 have the lowest probability of coming out while 50 (which is the middle) is the one with the highest probability... practically, moving away from the center the rarity that comes out that number is always greater until it becomes almost impossible. For example the number 99.9 comes out 1 time in 5 billion, but as I said it is just an example so the rarity of the numbers must be established by the function. Basically I would like to say that the closer you get to 100 or 0, the rarity tends to infinity.
However, I would like it to be a function with a min
parameter and a max
parameter to make it more versatile.
(Sorry if the question is not very clear but i'm not native and i'm still learning english...)