Random web page?

Steve Holden sholden at holdenweb.com
Thu Apr 17 17:12:05 CEST 2003

"Anton Vredegoor" <anton at vredegoor.doge.nl> wrote in message
news:b7m4ql$ril$1 at news.hccnet.nl...
> 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 ;-)

In order to be able to generate all pages with exactly equal probability you
have to know the cardinality of the set of all pages. Which nobody does,
because it changes all the time.

Assuming you did know how many there were, you'd simply need to build a list
of them all and then use whrandom.choice() to select an arbitrary element.
Assuming you have enough memory to store a list of 12,000,000,000+ elements,
of course ;-)

If you ever do work out a suitable method, please mail me via
http://www.myrandomwebpage.com/ :-)

Steve Holden                                  http://www.holdenweb.com/
How lucky am I?      http://www.google.com/search?q=Steve+Holden&btnI=1
Python Web Programming                 http://pydish.holdenweb.com/pwp/

More information about the Python-list mailing list