If you read Genisis, you see that God was sorry he had made man.
Gen 6:5-7 And the Lord saw that the sin of man was great on the earth, and that all the thoughts of his heart were evil. And the Lord had sorrow because he had made man on the earth, and grief was in his heart. And the Lord said, I will take away man, whom I have made, from the face of the earth, even man and beast and that which goes on the earth and every bird of the air; for I have sorrow for having made them.
This shows us that to a degree, God was surprised at how bad man had become. This shows us that a) man has free will, b) man is not controlled by God.
However, it would appear from Scripture that God does in fact preplan many things. Whether a flood scenario was prepanned or not we do not know.
The idea that "everything is preplanned" is a Calvinistic idea, that is taken from a few passages in the Bible, but in my opinion, is not supported by remaining scripture. I discuss it here
Is Predestination real? | Everybody Matters Ministry