I'm mad at my friend
What happened between you two?
He randomly messes with me and then runs away.
You are not behaving in an understanding way towards your friend. You should talk things over calmly and rationally instead of being angry. You are not treating your friend fairly.
My friend is acting like a dick.
He may have been hurting you unintentionally, but he might not think that's happening. I believe you should be more forgiving to your friend, and tell him how it makes you feel when he does this. Your relationship deserves to flourish.