With prayer and humble dependence on God that he would reveal his will, the apostles cast lots (1:14, 24). This was a traditional way to discover God’s will (see Leviticus 16:8; Numbers 27:21; Deuteronomy 33:8; Joshua 14:2; 18:3–10; Proverbs 16:33). God chose Matthias by lot to replace Judas. After Pentecost, the Holy Spirit guided the followers of Jesus through dreams, visions, and prophecies instead of through lots (compare Acts 2:17–18; 13:2; 16:7–10).
You know everyone's heart: See also 1 Samuel 16:6–7; 1 Kings 8:39; 1 Chronicles 28:9; 2 Chronicles 6:30; Psalms 7:9; 44:21; Jeremiah 11:20; John 2:24–25; Revelation 2:23.