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 Messenger of Allah ﷺ 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 Messenger of Allah ﷺ 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. (Using translation from Muslim 2645a)
أَنَّهُ سَمِعَ عَبْدَ اللهِ بْنَ مَسْعُودٍ يَقُولُ الشَّقِيُّ مَنْ شَقِيَ فِي بَطْنِ أُمِّهِ وَالسَّعِيدُ مَنْ وُعِظَ بِغَيْرِهِ فَأَتَى رَجُلٌ مِنْ أَصْحَابِ رَسُولِ اللهِ ﷺ يُقَالُ لَهُ حُذَيْفَةُ بْنُ أَسِيدٍ الْغِفَارِيُّ فَحَدَّثَهُ بِذَلِكَ مِنْ قَوْلِ ابْنِ مَسْعُودٍ وَقَالَ كَيْفَ يَشْقَى رَجُلٌ يُغَيَّرُ عَمَلُهُ فَقَالَ لَهُ الرَّجُلُ أَتَعْجَبُ مِنْ ذَلِكَ فَإِنِّي سَمِعْتُ رَسُولَ اللهِ ﷺ يَقُولُ إِذَا مَرَّ بِالنُّطْفَةِ ثِنْتَانِ وَأَرْبَعُونَ لَيْلَةً بَعَثَ اللهُ إِلَيْهَا مَلَكًا فَصَوَّرَهَا وَخَلَقَ سَمْعَهَا وَبَصَرَهَا وَجِلْدَهَا وَلَحْمَهَا وَعَظْمَهَا ثُمَّ قَالَ يَا رَبِّ أَذَكَرٌ أَمْ أُنْثَى فَيَقْضِي رَبُّكَ مَا شَاءَ اللهُ وَيَكْتُبُ الْمَلَكُ فَيَقُولُ أَيْ رَبِّ أَجَلُهُ فَيَقُولُ رَبُّكَ مَا شَاءَ وَيَكْتُبُ الْمَلَكُ فَيَقُولُ أَيْ رَبِّ رِزْقُهُ فَيَقْضِي رَبُّكَ مَا شَاءَ وَيَكْتُبُ ثُمَّ يَخْرُجُ بِالصَّحِيفَةِ فِي يَدِهِ فَلَا يَزِيدُ عَلَى أَمْرِهِ وَلَا يَنْقُصُ