unity have random bullet spread code example
Example: unity projectile spread
Quaternion spread = Quaternion.Euler(transform.rotation.eulerAngles + new Vector3((Random.Range(-amount, amount), Random.Range(-amount, amount), 0f));
GameObject bullet = Instantiate(bulletPrefab, transform.position, spread)
bullet.GetComponent<Rigidbody>().AddRelativeForce(Vector3.forward * Force);