Hadithcore
Mishkat al-Masabih, 3080

'Abdallah b. Mas'ud reported God’s Messenger as saying, “Young man, those of you who can support a wife should marry, for it keeps you from looking at strange women and preserves you from immorality; but those who cannot should devote themselves to fasting, for it is a means of suppressing sexual desire.”* (Bukhari and Muslim.) * <i>Waja'</i> has been translated freely above. It means castration.

عَنْ عَبْدِ اللَّهِ بْنِ مَسْعُودٍ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «يَا مَعْشَرَ الشَّبَابِ مَنِ اسْتَطَاعَ مِنْكُمُ الْبَاءَةَ فَلْيَتَزَوَّجْ فَإِنَّهُ أَغَضُّ لِلْبَصَرِ وَأَحْصَنُ لِلْفَرْجِ وَمَنْ لَمْ يَسْتَطِعْ فَعَلَيْهِ بِالصَّوْمِ فَإِنَّهُ لَهُ وِجَاءٌ»

References1 variant
In-Book Reference
Book 13, Hadith 1