[Haskell-cafe] All the random packages

Aleksey Khudyakov alexey.skladnoy at gmail.com
Sun Jan 8 15:58:09 CET 2012

On 08.01.2012 11:18, Eugene Kirpichov wrote:
> Hi,
> I came across the beautiful algorithm for O(1) generation of rational
> discrete distributions http://www.keithschwarz.com/darts-dice-coins/ and
> though it'd be fun to implement it in Haskell and put on Hackage, but
> then it turned out that there's about a dozen random number packages, so
> I'm not sure to which one to contribute, or better to roll out my own
> package and encourage authors of the other packages to reference it and
> fit under their interface.
I think it was first described in the paper "Fast generation of discrete 
random variables" by Marsaglia et.al.[1] It's called squared histogram 
method in the paper. Another one is quite elegand as well. They claim 
claim that these algorithms are fastest.

Also I would avoid floating point numbers for following reasons. They 
are tricky and difficult to reason about. Random numbers are generated 
as words and conversion to float/double will inevitable lose some entropy.

> Which random number packages are considered to be most mature or perhaps
> promising - i.e., contributing to which ones will bring the community
> the most benefit?

Difficult to say. Reverse dependencies[2] could be of interest.

> Is there any effort on unifying them going on?
I'm not aware about such thing,

[1] http://ideas.repec.org/a/jss/jstsof/11i03.html
[2] http://packdeps.haskellers.com/reverse

More information about the Haskell-Cafe mailing list