The Messenger of Allah ﷺ said, "Allah has distributed your character among you just as He has distributed your provisions among you. Allah grants worldly things to those He loves and to those He does not love, but He grants faith only to those He loves."
قال رسول الله ﷺ: إن الله قسم بينكم أخلاقكم، كما قسم بينكم أرزاقكم، وإن الله يعطي الدنيا من يحب ومن لا يحب، ولا يعطي الإيمان إلا من يحب.
Reported by Hakim (1/33-34) through various routes from Ahmad bin Junab Masissi, who said, "Isa bin Yunus narrated to us," from Sufyan Thawri, from Zubayd, from Murrah, from Abdullah, and he related it. Hakim said, "This is a sahih hadith." The discussion of it is set out at length in Kitab al-Iman.