That's not how evolution by natural selection works /\/\
True, which is why natural selection fails to explain the development of species.
What happened is that the giraffes who were most ideally suited to reach food sources tended to survive while those who couldn't died off prior to reproducing. Over thousands and thousands of generations, this left only DNA in the gene pool that supported the phenotype of longer and longer necks.
Giraffes didn't "change" to suit their environment. Long-necked giraffes were "selected" by nature to survive and flourish.
This assumes huge variation in populations, which is supported neither by observed animal traits nor by the fossil record.
The mechanism behind evolution is unlikely to be natural selection based on random mutation.
The hypothesis is not supported by the evidence.