Y gives grave and sudden provocation to A. A, on this provocation fires a pistol at Y, neither intending nor knowing himself to be likely to kill Z, who is near him, but out of sight. A kills Z. Here, A has committed the offence of :
Culpable homicide not amounting to murder
Under Exception 1 to Section 300 of the Indian Penal Code (now Section 101 of the Bharatiya Nyaya Sanhita, 2023), culpable homicide is not murder if the offender, while deprived of the power of self-control by grave and sudden provocation, causes the death of the person who gave the provocation, or causes the death of any other person by mistake or accident.
The illustration to this Exception describes exactly these facts: Y gives grave and sudden provocation to A, A fires at Y without intending or knowing that he is likely to kill Z, who is near but out of sight, and kills Z. The Code states that A has not committed murder, but merely culpable homicide.
This also follows from the rule of transferred intention in Section 301 IPC (now Section 102 BNS): the act is treated as if A had killed Y, the provoker, so the provocation exception applies to the death of Z as well.
It is not murder because the provocation exception applies; it is not "no offence" because A intended to cause death; and it is not causing death by negligence because the act was intentional, not rash or negligent.
Hence, Culpable homicide not amounting to murder.