Light doesn't need to decide. It simply behaves both ways at the same time.
If you create an experiment that can detect particles and run light through it, the experiment detects particles.
If you build an experiment that can detect waves and run light through it, the experiment detects waves.
Wierd but true.