Dr. Strange saw a single future out of many futures in which Thanos would be defeated and chose the way.
But how could he be sure who would die if they were destroyed randomly?
Movies & TV Stack Exchange is a question and answer site for movie and TV enthusiasts. It only takes a minute to sign up.Sign up to join this community
The core of your question is not related to the movie, it is related to your understanding of randomness.
With contemporary scientific accuracy in mind, nothing is truly random. Everything is determined when you observe it with sufficient precision. Just because we can't predict it doesn't mean that it was therefore unpredictable.
Humans have never encountered something that was provably unpredictable, but then again, we could never be sure that we had perfect information so that we could come to that conclusion.
The result of a coin flip can be determined while it is still in the air, assuming you have perfect knowledge about the coin's weight distribution, the velocity (both linear and angular) it has, and any environmental factors (gravity, wind, magnetic interference, ...).
Therefore, even if Thanos cannot consciously control it, his selection was not random. There are two possibilities here:
Firstly, it's possible that the selection criteria were fixed. For example, let's say the infinity stones order a list of all people by their precise date of birth, and then decide to kill every second person. This guarantees a 50% mortality and it is not a biased selection.
This is not random, but to humans it will appear to be random. If someone has access to accurate ordered list of people, they will understand that the selection was not random. If someone does not have access to this list, they are unable to spot the pattern and therefore assume it was random.
Secondly, Thanos could have somehow provided a random seed. For the sake of example, let's say that he thinks of a word, and the randomness is then generated from that word. Thanos' decision, while seeming random, is not random. It is based on whatever his mind was thinking about. Therefore, Thanos' experiences influence the word he chooses.
The reasons for choosing a particular word are unknown to us and impossible to confirm. However, what we can conclude is that if Thanos' experiences are set in stone, so is the word he subsequently chooses.
For example, let's say that Thanos chooses "Gamora" as his word because he mourns for her. In that case, Strange is able to force Thanos' word choice if he's able to ensure that Thanos ends up killing Gamora, thus causing him to always pick "Gamora" as his random seed.
This means that Strange could have found a particular combination of events that leads Thanos to select a particular word, thus causing particular Avengers to survive, thus making it possible for the survivors to defeat Thanos.
What would happened if people dead after Gauntlet effect of Thanos weren't like the future Dr.Strange saw?
Nothing would happen.
Remember that Dr. Strange saw 14,000,605 futures.
Dr. Strange: I went forward in time to view alternate futures. To see all the possible outcomes of the coming conflict.
Quill: How many did you see?
Dr. Strange: 14,000,605.
Tony: How many did we win?
Dr. Strange: One.
He chose the best path to go on which will lead them to their victory. He saw who would die and would be left after their fight. We don't know what exactly he saw yet. Maybe there were futures where the characters you mentioned were gonna die, but Dr. Strange didn't simply select it.