I heard the Messenger of Allah ﷺ say, "Allah created His creation in darkness, then cast upon them some of His light. Whoever was touched by that light was guided, and whoever missed it went astray. That is why I say, the pen has dried upon what Allah
knows."
سمعت رسول الله ﷺ يقول: إن الله عز وجل خلق خلقه في ظلمة، فألقى عليهم من نوره، فمن أصابه من ذلك النور اهتدى، ومن أخطأه ضل. فلذلك أقول: جف القلم على علم الله عز وجل.
Tirmidhi (2642) narrated it from Hasan bin Arafah, who said, Ismail bin Ayyash narrated to us, from Yahya bin Abu Amr Shaybani, from Abdullah bin Daylami, who said, I heard Abdullah bin Amr, and he related it. Its chain is hasan because of Ismail bin Ayyash, for he is truthful in his narrations from the people of his own land, and this is one of them. Tirmidhi said, "It is a hasan hadith." The discussion of it is given at length in the book on faith.