I was trying to find or make a function which is not equi-probable, meaning some values are less probable than others. Apparently what I want has something to deal with http://en.wikipedia.org/wiki/Normal_distribution and Gaussian Distributions.

The math and algorithmics involved in such a function seemed a little complex, and I was not sure if they were really necessary.

My goal is to make better loot more rare to get (the player can generate an infinite amount of loot events), but since I want the loot quality to be expressed with a single value, I need a function that returns values > 0.9 very rarely but will return value > 0.1 much more often.

I tried log((100*random())^(0.01*random())) ('^' meaning exponent, so '**' to be precise) in python, I got results that seems pretty satisfying, but I'm really suspicious that I can can trust those results.

Is there some type of standard function that already do what I'm looking for ? Do you think this formula is somehow reliable ?

I don't want to have "loot tables" because they're integral values, and it would require more tweaking, and I don't intend to have special items that are much more powerful than lower tier items.

In this way you have a probability density function where low values have the most chance to be selected.. the drowback is that is not flexible but you can change the values of conditions or increase/decrease the number of "if" to obtain the desired function.

How about a trivial power function? Take a random number in the 0 to 1 interval, raise it to the power "needed". This is easy to calculate and different selections of exponent will give you the loot-rarity you want.

\$\begingroup\$No, because all those picks are equiprobable. I had this idea at first, but when you do stats on it, if you call that function 1000 times, and look at how it distributes, it's odd results.\$\endgroup\$
– jokoonApr 29 '15 at 16:07