You know, I too have had those struggles in the past about violent thoughts randomly coming into my head. I didn't think that they were too much of a problem and didn't bother with them for years. One day I realized that I didn't want to allow those violent thoughts to take up any space in my mind. After all, I really wouldn't hurt myself physically and I hate the feeling of pain. (Plus, I couldn't stand the added horrible nightmares every night.)
What really helped me get on the right path was learning more about the scientific findings on the brain. One neurologist, Dr. Caroline Leaf, discovered that with something called neuroplasty (something our brains have) we can actually rewrite our thoughts, memories and thought processes!
One guy, Dr. Hegstrom, had a stroke and after training himself to use the neuroplasty to "wire around" the damage in his brain, he now speaks and thinks better than before the stroke. And the other doctors (who weren't neurologists) said he wouldn't be able to do all that!
I know that Dr. Leaf has several books, some of which I have read. One that helped me the best was one called "Who Switched Off My Brain? Rewriting Toxic Thoughts". If you are interested you can find it in any book store (if you don't have the money to buy it, you can sit in the store and read it).
Now I don't have to let those thoughts run their course in my head and there is more to our thoughts than this!
So, I want to encourage you and tell you that if I can do it, you can do it! For sure!