I don't know if it is 'stim' per se, but I have always played mental scripts and games and frequently the same ones over and over. When I want to sleep I play a mental script, a story I write from the beginning over and over night after night with little variation. I will drift off often in the opening section before ever getting too something new. If not my mind will head off in some other direction. I have thought of it as a relaxation technique.