When do you get hit by lightning on Minecraft?

Lightning only occurs during thunderstorms. There is a slim chance of getting struck by lightning. Being struck by lightning will do 5 hp (Two and a half hearts). If lightning zaps a pig it turns into a zombie pigman, a villager to a witch, a horse to a skeleton trap horse, If a creeper is struck it turns the creeper into a supercharged and more dangerous creeper.