If you had a super computer that could generate a random 157929 character string 1 quintillion times a second, it would take the entire age of our universe (13.7 billion years) 10^10^5.876431387628888 times over for Hamlet to be written.
Which is to say the entire universe would likely be dead (expanded and collapsed) for trillions of years by the time the super computer would finish.
To put it another way, it's beyond the scope of time. All the time that has existed and that will ever exist is not enough to produce Hamlet.
Here's the wolframalpha computation. http://bit.ly/rcE7MQ
Factor of 157929 (157929!) divided by 1 quintillion, divide that by 13.7 billion years.
x! is the number of possible permutations of a finite set containing x elements.
So what you've calculated is the time it would take a computer to generate every possible permutation of every character in Hamlet, assuming it treated every character as a distinct element.
Also, the calculation you're using would be if the computer could generate a quintillion stings per year. So that knocks a few zeros of the end.
x^n (I think) is the number of unique strings of length n you can generate from a set containing x elements.
Lets assume this is going to be in all caps, and the only typographical symbols allowed are space, comma, period, colon and end of line. So you've got 32 possible symbols. (Makes things nicer for the programmer), and that every atom of the universe is part of a computer and can store one symbol, and the computer is capable of changing each atom a quintillion times a second.
Then you've only got 2.4766... x 10^237596 current lifetimes of the universe for the computer to run.
http://goo.gl/P2UTQ
So yeah... combinatorial math quickly produces mind-fuckingly huge numbers.