Is there such a beast as a "perfect" shuffle? :)

Sean 'Shaleh' Perry shalehperry at attbi.com
Fri May 10 13:20:50 EDT 2002


On 10-May-2002 Christos Georgiou wrote:
> I needed a function that, given a sequence and a number, would produce
> the <number>th permutation of the sequence.  I thought I once saw such a
> function, but using google (web and groups) couldn't find it, so I wrote
> one of my own (it's at the ASPN cookbook site:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/126037 )  
> Basically, this was because I was aiming for a "perfect" shuffle of a
> deck of 52 cards, so I wanted to reduce the "randomness" factor to only
> one number.
> 

I seem to remember reading an article linked off of slashdot where they go into
the dynamics of shuffling cards and how to ensure a full spread of
possibilities.

There may or may not be a site talking about this in the context of python, but
anything they say should be relevant.





More information about the Python-list mailing list