A cat can spawn if that block is less than 2 chunks from a village with fewer than 5 cats, or inside a swamp hut. A random player is selected (including spectators) and a random location is chosen 8-32 blocks away from the player horizontally in both directions and at the same height.
Cats can spawn every 1200 ticks (1 minute).