A population of lizards lived in an ecosystem that was prone to flooding. After many generations, most of the lizards in the population had longer legs than their ancestors, which helped them flee from floods. Which statement best explains this change?