Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:29:21

He punishes whom He wills and has mercy upon whom He wills, and to Him you will be returned.  

He chastises whomever He will, to chastise, and has mercy on whomever He will, to have mercy, and to Him you shall be returned.
القرآن:٢٩:٢١

يُعَذِّبُ مَنْ يَشَاءُ وَيَرْحَمُ مَنْ يَشَاءُ ۖ وَإِلَيْهِ تُقْلَبُونَ  

{يعذِّب من يشاء} تعذيبه {ويرحم من يشاء} رحمته {وإليه تقبلون} تردون.