Random web page?

Peter Hansen peter at engcorp.com
Thu Apr 17 15:20:54 CEST 2003

Anton Vredegoor wrote:
> From the universe of all currently available webpages (where
> "currently available" means available on the world wide web at the
> runtime of the script) I want to select a page in such a way that each
> page has an equally likely chance of being selected. Any idea about
> how to accomplish this is equally likely to be welcome ;-)

Sounds rather silly, since there can't possibly be much value
in selecting from literally *all* pages with *equal* probability,
can there?  But anyone, here's an idea that goes part-way there.

1. Generate random IP addresses.  Easiest way is using an integer
   which is converted to a net address using tools in "socket".

2. Try connecting on port 80.

3. If there's something there, display it and you're done.  Else loop.

Now if you consider that a starting point, for discussion, what
part of it doesn't serve your purpose, and why?


More information about the Python-list mailing list