Camera on my phone keeps randomly coming on

Hmm. Have you tried Safe Mode, to test whether a third-party app is responsible?
 
Maybe a virus is doing that ,or it can be a third-party application too.. An antivirus program might work. Also you can uninstall applications which wants too many permissions..