I can tell you ours doesn't randomly switch. However, we do manually switch it fairly often as we play our record player through the Bluetooth input on the soundbar and wireless surround. (Yes, you read that right.)
Since we do switch the input at times, that may be a reason it won't randomly switch. Just keeping it on one input may cause the issue.
Not sure, but I have read up on two "common" issues with Samsung:
The soundbar issue I stated above, and on their TVs (and both my last one and my new QLED do this) they occasionally randomly turn themselves on. On my old one, I would (maybe 3-4 times a year) come home from work to the TV on, or wake up at 0200 and think someone broke in.
On my new TV, it has so far only happened after I turn it off. And I don't mean like 5 seconds after I turn it off, which could be me double pressing the power button, it's more like 30 seconds.
Again though, I really like the sound quality of the Samsung soundbars, and I want another one for this TV. I'm just going to carefully research. Last time I bought it on Amazon. This time I might get one when Costco has them (they only seem to be in stock a few times a year) because then, even a year later, it's an easy return at my local Costco whether I bought it in the store or online.