Generating a random subsequence

Martin v. Loewis martin at v.loewis.de
Mon Jan 7 18:32:18 EST 2002


Tom Bryan <tbryan at python.net> writes:

> def randomSubseq( seq, length ):

What would be wrong with

      return random.shuffle(seq[:])[:length]

I don't see the value of shuffling the indices.

Regards,
Martin



More information about the Python-list mailing list