'Abdullah b. Mas'ud reported
Evil one is he who is evil in the womb of his mother and the good one is he who takes a lesson from the (fate of) others. The narrator came to a person from amongst the Companions of Allah's Messenger (ﷺ) who was called Hudhaifa b. Usaid Ghifari and said: How can a person be an evil one without (committing an evil) deed? Thereupon the person said to him: You are surprised at this, whereas I have heard Allah's Messenger (ﷺ) as saying: When forty-two nights pass after the semen gets into the womb, Allah sends the angel and gives him shape. Then he creates his sense of hearing, sense of sight, his skin, his flesh, his bones, and then says: My Lord, would he be male or female? And your Lord decides as He desires and the angel then puts down that also and then says: My Lord, what about his age? And your Lord decides as He likes it and the angel puts it down. Then he says: My Lord, what about his livelihood? And then the Lord decides as He likes and the angel writes it down, and then the angel gets out with his scroll of destiny in his hand and nothing is added to it and nothing is subtracted from it.