How to stop exploiters changing shotgun spread?

Hi I want to make a raycast shotgun that compensates for latency. I want the script to check if the origin of the ray, and closest point of the ray are in a certain distance to the ray created in the server. But there is a problem, how do I do this for random shotgun spread? What if an exploiter changed the spread? I have seen people saying to use randomseed so that the client and server have the same spread but I do not know how to do it. I really need help.