Can a guy get randomly hard?

I’m asking this question because I’ve been with my boyfriend for about 3 years now an this has been a thing since then. He’ll get hard just randomly he said it’s because he’s completely relaxed? Im just curious because it happens anywhere like while she’s driving , or we’re laying down together watching a show together , I just wanna know if he’s thinking about scenarios in that moment or if like he says it’s just random?
Can a guy get randomly hard?
Post Opinion