I think random erections are totally normal. So is masturbation but if they are looking and touching friends that needs to nipped in the bud. They need to learn that those are private aprts not be shared with their friends. Also, I think teaching them that if they do touch themselves they do it in private in their own room.
They figure out that if they play with it, it grows. They should NOT be sharing body parts with their friends, that is not ok. They do need to know that it is ok to touch themselves but it should be done in private. Don't freak out, it is normal and developmentally appropriate.