My nephew committed suicide just over a decade ago. Since then I have followed the issue and paid attention to it. The single most common thread through most suicides anymore is psychotropic medicines, such as Ritalin, Prozac, etc.
What the medical community has come to learn is that there is a very strong association in withdrawals from these 'mind altering' medications and violent thoughts and behaviour to include suicide. In fact, pay attention to TV commercials for these types of medicines. They tend to be 60-second commercials and over half of the commercial will be used to identify potential side effects, and virtually all of them mention violence or suicide.
Dosage, length of use, etc are extremely important. My nephew would be 30 right now. He was first prescribed Prozac when he was 5 years old! Back then it was the wonder drug. Seemed to cure everything and was handed out like candy. What they have learned since is that for children prescribed this (and similar drugs): 1) if prescribed for X period of time 2) below a certain age, suicide is almost 100%, either successful or attempted. Based on this kind of data they are much, much, much more careful about prescriptions, warning signs, etc. My nephew was one of tens of thousands who served at ground zero for the learning curve.
Final thought, this is clearly not related to all cases. Just an informed observation. In fact, you would be amazed at how many of these mass public shootings involved young people either on or in withdrawals from these types of drugs. Again, it does not answer every action but amazing at how many cases are linked.