Sahih Muslim | Book 33 | Hadith Number 6393

Narrated by 'Abdullah b. Mas'ud
'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 lesson from the (fate of) others. The narrator came to a person from amongst the Companion of Allah's Messenger (may peace be upon him) 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 (may peace be upon him) as saving: When forty nights pass after the semen gets into the womb, Allah sends the angel and gives him the 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.