God is omniscient and He knew that he had to destroy the world by flood.
But, the bigger question is...
"If God knew that He had to die for human, why did He create human anyway?"
Revelation 13:8 (NIV) All inhabitants of the earth will worship the
beast—all whose names have not been written in the Lamb’s book of
life, the Lamb who was slain from the creation of the world.
Ephesians 1:4 (NIV) For he chose us in him before the creation of the
world to be holy and blameless in his sight. In love
When God created the world, Adam and Eve, Christ was already crucified in the mind of God. God created everything according to His will. There was no accident. He knew what He was doing and what purpose it would serve. He knew that Adam and Eve might fall into the trap of Satan, fall under the power of sin and the Lamb of God had to be sacrificed for their sins. However, it was God's plan to create human and while creating them, God already conceived in His mind that the Son of God will be crucified.
God foresaw that many will be destroyed by His wrath:
God had the foreknowledge of how He must purify the world by flood but there is a bigger judgement ahead. While God knew that many will be saved through Christ's sacrifice, He also knew that still many more will be destroyed by His wrath; He knew that many will go to Hell by rejecting Jesus Christ. God was ready for all the outcome, both the salvation of few and the destruction of many, and was ready to pay the price.
But why did God plan all this? Only God knows.
Isaiah 55:8-9 (NIV) “For my thoughts are not your thoughts,
neither are your ways my ways,” declares the Lord. “As the heavens are higher than the earth,
so are my ways higher than your ways
and my thoughts than your thoughts.
We have no right to question God our creator
Romans 9:20-21 (NIV) But who are you, a human being, to talk back to God? “Shall what is formed say to the one who formed it, ‘Why did you
make me like this?’” Does not the potter have the right to make out of
the same lump of clay some pottery for special purposes and some for
Isaiah 45:9 (NIV) “Woe to those who quarrel with their Maker,
those who are nothing but potsherds
among the potsherds on the ground. Does the clay say to the potter,
‘What are you making?’ Does your work say,
‘The potter has no hands’?