How to shoot raycast with slight random direction?

I want to shoot a raycast to check where my gun has fired, but with the shotgun I’m going to want to randomize the precise direction of the ray slightly with each shot.

How would I do this?

Currently I use if (Physics.Raycast(shotOrigin.position, shotOrigin.forward, out hit, 1000, layerMask)) to shoot a ray straight out (forward) from the barrel of the gun with each shot, so I need to find a way to vary that “forward” angle up a little bit.

You might want to use Quaternion.AngleAxis. Create a random float for your angle and multiply shotOrigin.Forward by the value you will get from AngleAxis value