What is thinking, what is a thought, how thoughts comes to us?
It is difficult to answer this question. The reason is when we think about this question, the other thoughts have become past. We might remember vaguely what our thoughts were, but we can't remember the order and if all thoughts are included and some are not missing.
I feel that external triggers are catalyst for thought processes. But wait about dreaming? Then three no catalysts. I think now it is believed that most of your dreams are related to your daytime activities. But we know that, randomly, we dream of past or very distant happenings of our life. It can be assumed that some randomness is involved. Even dreaming is a process it is a story. Therefore it has to be a connected set of triggers and responses, with some randomness. That is why the dream is not exactly a daytime happening. it will have slight or sometimes big deviations. It might use multiple recent daytime happenings, and some stored in the memory.
Thinking may consists of triggers made by sensory inputs.
This will include, the room temperature, some gust of cold wind that strike you, the whether in general, the gloominess, even the humidity in the air will have some bearing on your thoughts. Headache, uncomfortable feeling of the stomach a body wound that may be hurting, etc.- in meditation I found that the power of concentration varies wether I had food or was with empty stomach.
Then there is memory stored in your brain. Then there may be some randomness. When I have depression, suddenly I will get feeling of loneliness and related thoughts. Hyperthyroidism cause depression. So chemicals of the brain also plays a part in getting random ideas.
The brain also have a time keeper, this may be helped by sensory inputs, like knowing day and night. Some thought triggers come from this time keeper.
Another thing is when one thought is centred around some subject, other thoughts, will be randomly generated around this subject.