
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. What do you think? 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? Is there any effort on unifying them going on? -- Eugene Kirpichov Principal Engineer, Mirantis Inc. http://www.mirantis.com/ Editor, http://fprog.ru/

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
participants (2)
-
Aleksey Khudyakov
-
Eugene Kirpichov