The problem is taken from Sheldon M Ross's Introduction to Probability Models (seventh Edition). Problem number 32, page 19 is stated as
Suppose all 'n' men at a party throw their hats in the center of the room. Each man randomly selects a hat. Show that the probability that none of the n men, selects his own hat isI've written a computer program to actually calculate the probability from the given sample space. The source code is at "The Hat Throwing Problem Code"
I have the analytical solution, but I want to hide it, till you solve it for yourself.