כֹּ֤ל פָּעַ֣ל יְ֭הוָה לַֽמַּעֲנֵ֑הוּ וְגַם־רָ֝שָׁ֗ע לְי֣וֹם רָעָֽה׃
The LORD hath made every things for His own purpose, Yea, even the wicked for the day of evil.
Read Jewish philosophical commentary on Proverbs 16:4: and classical philosophical sources.