
Definately training rather than castration.
My dog went through a stage of trying to hump people (mostly me), very occasionally if he is excited he may have a half-hearted attempt now, but is easily stopped with a 'ah ah', it's no problem atall (4 yr old English Mastiff, entire)
For training, see if your friends can identify a trigger, it sounds strange but there may be a common 'thing' prior to the humping, with my dog it would be me on my hand & knees washing/brushing the floor!, he'd sneak up behind me, get his front half over my shoulders and start humping while sometyimes even chewing my head/neck

Not funny being that he weighs in at about 14 stone, as I simply couldn't get out from underneath him

I would have to get my OH to pull him off.
Rather than distracting for this, I would make sure I kept an eye on him when I was on all 4's! If he started to walk towards me, I'd tell him 'no'/'ah ah', if that didn't stop him getting closer I'd stand up and send him to his bed. Sounds really simple but it was all that was needed to stop the behaviour turning into a habbit :)
He does a bit of huming when over-excited playing with a doggy friend, for that a time out for him to calm down + a trying to get that time-out in before he starts the humping has been the best thing for that.
From the other side of things, my last dog was a rescue. He was entire when we got him at 4 years old, from a rescue centre. He had a very ingrained habbit for humping, unfortunatley we found it funny and even got him to hump anything on command. It seemed like harmless fun that the dog enjoyed, but when the dog was hanging off the Dr's leg (pre-natal home visit) humping the living daylights out of him and we couldn't stop him, only then did we realise how STUPID it was to encourage his humping :(
We got him castrated when he was about 6 years old as he'd also try to escape to look for bitches and after being run-over by a car, the castration was an attempt to keep him safe. The castration did stop him wanting to escape and stopped him pacing and whining over bitches, but it did NOTHING for his humping. We hd to train that out of him.
It's sooooooooooooooo much easier to train out humping when you get the chance to do it with a dog that has only just started the behaviour, than with a dog that has had years of practice & encouragement. :)