Book of Deuteronomy
The Book of Deuteronomy says that a soldier who became impure through a "mikreh lailah" ("night occurrence") must leave the army camp, immerse, and only return to the camp in the evening. From the word "mikreh" (מקרה), the rabbis derived the term "keri" (קרי) to refer to an emission of semen.