[Haskell-cafe] random shuffle and random list partition

Manlio Perillo manlio_perillo at libero.it
Mon Mar 16 19:15:39 EDT 2009


Hi.

For my Netflix Prize project I have implemented two reusable modules.
The first module implements a random shuffle on immutable lists.
It uses http://okmij.org/ftp/Haskell/perfect-shuffle.txt, with an 
additional "wrapper" function, having a more friendly interface.

The second module implements a function used to partition a list into n 
sublists of random length.


I have pasted the modules here:
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2483
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2485

If someone is interested (and if Oleg give me permission), I can release 
them as a package on Hackage.
I need to improve documentation, however.

In future I can add an implementation of the random shuffle algorithm on 
mutable arrays in the ST monad.




Manlio


More information about the Haskell-Cafe mailing list