A minor grumble, but the filenames are not intuitive at all to me... It makes finding what I'm looking for a bit difficult.<p><pre><code> alea.py
clea.py
dlea.py
flea.py
ilea.py
lea.py
olea.py
plea.py
tlea.py
</code></pre>
Also if anyone is interested in floating point weights, look at the alias method. Good tutorial here: <a href="http://www.keithschwarz.com/darts-dice-coins/" rel="nofollow">http://www.keithschwarz.com/darts-dice-coins/</a><p>EDIT: User rawnlq beat me to mentioning the alias method. I second the recommendation.
Oh, that looks <i>nice</i>. This is really great. I worked on a project a while back in which I needed to generate a discrete probability distribution, and found Python's support for this to be lacking. I ended up having to hard-code most of the distribution and then use multipliers to cover other cases, which I found very mathematically unsatisfying.<p>Thus, I think Lea looks very helpful for certain use-cases related to discrete probability. Great!
I was hoping to see an implementation the alias method [1] for sampling from discrete distributions! Nonetheless very cool.<p>[1] <a href="http://en.wikipedia.org/wiki/Alias_method" rel="nofollow">http://en.wikipedia.org/wiki/Alias_method</a> or <a href="http://www.keithschwarz.com/darts-dice-coins/" rel="nofollow">http://www.keithschwarz.com/darts-dice-coins/</a>
I'm under way on something like this for JavaScript with a buddy of mine. <a href="https://github.com/jacobmenick/sampling/" rel="nofollow">https://github.com/jacobmenick/sampling/</a>
The great thing about python is that we all get to implement such a library ourselves, using our own idioms and lack of documentation and/or unit tests.