How do I turn a discrete sound effect into a seamless loop?

How long does the sample need to be?