When random thoughts affect your mood

I don't know if this is an autistic experience or something else.

I could be going about my day, minding my own business, and suddenly I'm reminded of a horrible thing someone said to me or a really bad mistake that I made. Suddenly it completely takes me off track.

It alters my mood almost instantly, and I didn't even choose to think about that thing. It just popped into my head, and it won't leave for a while.

Sort of related: I did a few diagnostic tests for OCD and I scored quite highly on all of them.