Yitzchak Gale ha scritto:
Hi Manlio,
Manlio Perillo wrote:
For my Netflix Prize project I have implemented two reusable modules.
The first module implements a random shuffle on immutable lists...
The second module implements a function used to partition a list into n
sublists of random length.
[...]
As you point out, your partition algorithm is not fair.
Using your Random.Shuffle and a well-know trick
from combinatorics, you can easily get a fair
partitions function:
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2485#a2495
Someone added an alternative implementation:
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2485#a2497
Regards Manlio
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe