Note:

The exact probability is 1/e, which is 0.367879...

This is a classic probability problem. Some textbooks refer to the idea of rearranging so that no one gets their own hat back as a derangement.