I have the same problem... as soon as I notice the "Random thoughts" more consciously, I snap out of it... I usually do some daydreaming/fantasizing/visualization when I go to bed. (It takes me a minimum of 30 minutes to fall asleep and I use that to keep the stressful thoughts of life at bay). Eventually, my concentration for the visualization fades away and the random, unrelated thoughts start coming.