There are flood myths from many different cultures. A common theme in the stories is the idea of punishing mankind for his sins while saving just enough people to start a better race.
China
We can see those elements in the Chinese myth where Gong Gong, so ordered by the head of the gods, created a flood as a punishment for human misbehavior. It lasted 22 years, until the hero started to dam the waters. The hero was killed for this act, but from his corpse sprang a son who finished his father's project.
Rome
The Greco-Roman story, recounted by Ovid, is another tale of collusion among the gods to punish evil humanity. Jupiter persuaded Neptune to flood all the earth except for the summit of Mt. Parnassus. There Deucalion and Pyrrha arrived by boat. The childless couple repopulated the earth by throwing their "mother's bones" (stones from "mother" earth) behind them. The stones became people.
Babylon
A Babylonian story with modern theme tells of the attempts by the gods to limit human population. Their third attempt was a flood, against which one of the gods (Enki, who sided with mankind more than the others), told Atrahasis to build an ark and load it with his family and animals.
When the flood ended, Enki made some women barren and created stillbirths to prevent further overpopulation problems.
Similar stories come from all over the world, leading many to conclude that there must have been an actual catastrophic flood. (www.calvin.edu/archive/asa/199604/0276.html) Geologic evidence points to the fact that the Mediterranean basin, once dry, underwent a major upheaval and flooding. Maybe it didn't last the 22 years of the Chinese version; maybe it didn't even last the 40 days of the Genesis version, although that would certainly be possible; maybe it only lasted the seven days of the Epic of Gilgamesh, but I'm sure, if it's anything like what we're going through now, it felt like an eternity without sunshine.