how to apply random sounds to a gun with silenced and unsilenced modes?

I know of “Math.random” but is there a different script for an m4a1-replacement that was hexed?