Jamie McDermott took a legal high before launching the assault on his victim in Belfast city centre.
The 29-year-old, of Crossan Walk, Lisburn, was ordered to serve 18 months probation after admitting the offence.
He must also pay £200 compensation to the man he targeted on 26 May.
Belfast Magistrates' Court heard the incident had been aggravated by his hostility and homophobic comments.
The victim said he and a friend had been walking in the Donegall Street area when McDermott ran up behind them and shouted abuse. He was then punched in the back before more slurs were directed at him, according to the prosecution.
McDermott was dishevelled and appeared to be under the influence of drugs when arrested.
His lawyer said he had made full admissions to the common assault charge and apologised for his actions.
She insisted he was not homophobic, having been looked after by a gay man earlier in his life, adding: "He said the incident happened when he was off his head."
After being told of McDermott's troubled background and addiction problems, the judge decided to impose a probation order.