pick randomly a certain fraction of numbers from a list
Alex Martelli
aleaxit at yahoo.com
Sun Feb 16 04:27:05 EST 2003
--- Carlos Ribeiro <cribeiro at mail.inet.com.br> wrote:
> 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?
Could well be, yes -- hmmm, I've been quite remiss
in contributing to the online Cookbook ever since
I started co-editing the printed version, then
went back to the Nutshell. Now that it's done,
guess I might well start contributing again -- tx
for reminding me!
Alex
__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
More information about the Python-list
mailing list