John 19:23-24

When the soldiers had crucified Jesus, they took his garments and divided them into four parts, one part for each soldier; also his tunic. But the tunic was seamless, woven in one piece from top to bottom, 24 so they said to one another, Let us not tear it, but cast lots for it to see whose it shall be. This was to fulfill the Scripture which says,
They divided my garments among them
, and for my clothing they cast lots.

Acts 1:26

And they cast lots for them, and the lot fell on Matthias, and he was numbered with the eleven apostles.

Proverbs 16:33

The lot is cast into the lap, but its every decision is from the Lord.

Our Lord knew which soldier would win his garment, he knew which apostle would replace Judas. He has never been surprised nor will he ever react to a situation. This same God is working all things for the good of those that love him and are called by his purpose. (Romans:28)