[Haskell-cafe] Linear shuffle

Atwood, John Wesley john.atwood at hp.com
Fri Jan 14 16:22:19 EST 2005


> Gracjan Polak <gracjan at acchsh.com> wrote:
> John Meacham wrote:
>  > Oleg wrote a great article on implementing the perfect 
> shuffle. with
>  > some sample code.
>  >
>  > http://okmij.org/ftp/Haskell/misc.html#perfect-shuffle
>  >
> 
> Thats the kind of answer I was hoping to get :) Thanks.
> 
> 
> shuffle could be useful in standard library. At least Python 
> has it. I 
> was translating some small Python program, the hardest part was the 
> missing shuffle function. What do you think?


Also, note that, in a lazy language, the algorithm's complexity 
will be dependent on the number of cards drawn from the deck,
are possibly sub-linear in the number of cards in the deck. 

John


More information about the Haskell-Cafe mailing list