When thoughts keep coming

There are some moments when thoughts seem to keep coming. For example, an event happens and then it triggers all the thoughts that seem true in the moment.

Or for example, when I am wanting to sleep, my mind likes to think about different things. I don’t think its worry. Somtimes those thoughts are just random.

In that moment, how do I stop or acknowledge my brain to not think about so many different topics all at once.