all possible combinations

Christopher Subich spam.csubich+block at block.subich.spam.com
Wed Jul 13 12:19:47 EDT 2005


rbt wrote:
> Expanding this to 4^4 (256) to test the random.sample function produces
> interesting results. It never finds more than 24 combinations out of the
> possible 256. This leads to the question... how 'random' is sample ;)

sample(population,k):
    Return a k length list of unique elements chosen from the population 
sequence.  Used for random sampling without replacement.  New in version 
2.3.

Working as designed, I'd say.  4! = 24.



More information about the Python-list mailing list