pick randomly a certain fraction of numbers from a list
Carlos Ribeiro
cribeiro at mail.inet.com.br
Sat Feb 15 18:09:42 EST 2003
On Saturday 15 February 2003 15:49, Alex Martelli wrote:
>
> [...describes an algorithm to select K out of N items...]
>
> You could formalize this into a proof by induction, but I'll leave it
> at this "handwaving" level. Point is, the Python solution is pretty
> trivial given this algorithm, e.g (warning, untested code):
>
> [...untested code...]
>
Isn't this a good recipe for Python's Cookbook?
--
Carlos Ribeiro
cribeiro at mail.inet.com.br
More information about the Python-list
mailing list