python & mathematical methods of picking numbers at random

Bart Nessux bart_nessux at hotmail.com
Thu Jan 15 21:08:23 CET 2004


Jeff Epler wrote:
> 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
> 

Because it works and it's fast and len(count) changes every drawing.




More information about the Python-list mailing list