import urllib
html = urllib.urlopen('http://random.yahoo.com/bin/ryl').read()
I think that pulling a random page is much easier to implement and will be far more random than anything you could program yourself. Any program designed to produce random pages will still have to adhere to whatever rules defining the structure of html. Since humans are much better and breaking rules than machines, a random page from the web is more likely to contain structures you won't get from a randomizer.
You don't have to use yahoo, there are probably other random link generators, or you could build your own.