Mental health and masturbation

Is it good for your mental health to masturbate? Like if you’re stressed or anxious, is it good to masturbate, or is that just me trying to avoid my problems by giving myself pleasure?