You know, this topic jogged a memory

. When I was in college, a neurophysiology team researched dreams and their origins.
They postulated that the randomness of dreams arose from the way the brain recycles short-lived neurotransmitters. After a day of consciousness, your brain has an excess amount of these key-and-lock building blocks. The brain moves these around, uses them, and recycles them in a nearly random fashion. Old memories or disconnected thoughts are activated, and the brain tries to make a story from these unrelated connections.