python & mathematical methods of picking numbers at random

Jeff Epler jepler at unpythonic.net
Thu Jan 15 14:43:46 EST 2004


It sounds like your co-worker has re-written sample.  random.sample(l, 1)
is the same as random.choice(l), so that's another source of inefficiency.

But why are *you* using 
    random.sample(range(len(x)), 25)
instead of
    random.sample(x, 25)
?

Jeff




More information about the Python-list mailing list