Bge shaky camera

Hi , i’m working on a FPS and i would to make game more realistic. my idea is to shake camera a little for about 1 second when i shoot. The camera should shake randomly with a python script and not with an animation. Can somebody share me a .blend file or the script.

thanks for your time.

Why do you want to shake the camera with python? Using an animation would be way easyer to achieve.
If you fear that the anim distorts your mouse look functionality you could just parent the cam to a new empty and shake that instead

Cam (eyes) -> shake empyt (hit/shoot anim) -> neck empty (look up/down) -> player collider (turn left/right)