At the beginning of Genesis just before G-d brings the flood, it says, “G-d saw that man’s wickedness on earth was increasing, and every thought which came from his heart throughout the day was purely evil. G-d was consoled (by the fact) that He had made man upon the earth (and not in heaven, where he would have caused the angels to rebel.) G-d decided in His heart (to cause man) pain.”
Rashi, the foremost commentator on the Bible writes the following, “as an answer for heretics.” “A non-believer one asked Rabbi Joshua the son of Korcho, don’t you believe G-d knows the future?” “Why then does it say, G-d had a change of heart?” Said Rabbi Joshua. “Have you ever had a male child? And, what did you do when he was born?” “Didn’t you know one day he would die?” And the non-believer answered. “In happy times happiness, and in mournful times I mourn. “
Rabbi Joshua said, “The same is with G-d. Even though He knows they would sin and be destroyed, He did not withhold from creating them, (especially) for the righteous ones that would be born from amongst them.”
As far as someone devoted to understand the ways of G-d, to whatever limited degree that is possible, Rashi already explains this point, at the beginning of Genesis. “Why does the Bible (which is intended to direct and instruct the world how to conduct oneself in a G-dly manner) begin with the creation of the world and not with the commandments?” And Rashi continues, because there is an important message G-d wants to communicate. “If any nation of the world decides to accuse the Israelites of stealing the Land of Israel, they could answer. G-d owns, and is ruler of the entire universe that HE created. He gives the land to whom He desires. First, he allowed others to dwell over there, and then, he preferred to give it to us.” That was the plan.
The same idea can be applied to our point of discussion. Did G-d have a change of mind when he decided to bring the flood and do differently than when he first created the world? And the answer is. There is no remorse, change of mind or heart.
In the same way G-d first placed other nations in Israel and then decided to give it to the Israelites, not because of any lack of vision on G-ds part or a change of heart, the same is with the flood. There wasn’t any mistake, but it is all part of THE plan.
That is why Rashi here intentionally writes that his explanation is directed to a heretic, an obstinately stubborn, non-believer. As far as someone looking to make whatever sense he is able to make of the world, he understands there is no contradiction between the knowledge of G-d and a person’s ability to have free choice. It is only the non-believer who insists and is intractably stuck, that Rashi needs to bring the story of Rabbi Joshua who brought examples from life, hoping this would help them better relate to the concept.
Just like a person will celebrate the birth of a child even though everyone knows the person must die one day, he understands that G-d bestows good for virtuous people even if in the future there may be a change of course.
Rabbi Joshua the son of Korcha is mentioned intentionally since he was renowned for his ability to deal with such persistent stubborn people. He had the strength and the knowledge. Regular people must be on guard and avoid debates and discussions with people who are a negative influence in their lives.