This link does a better job of elaboting than I could. But essentially there are punishments outlined for particular crimes. However, the judge may determine the severity of the outlined punishment on a case by case basis. Also, there are alternative punishments that a judge may use at their discretion, or at the request of the defense.
https://www.nolo.com/legal-encyclopedia/criminal-sentencing-faq.html
Here’s an article about 7 unusual punishments given by judges.
https://theweek.com/articles/474331/7-ridiculously-bizarre-court-sentences
I’d love to read the article but this is as far as I got
Reloading the page got rid of it but still wtf. Forcing me to leave your website and reload the page is idiotic.