made him "very aware" of the spectre of death.
Miranda, 39, said his friend accidentally drowned, which made him "aware of the ticking clock earlier".
He added: "And I think I am drawn to characters who are very aware of it."
Miranda shot to fame in 2015 when Hamilton became a Broadway smash. The show uses hip-hop to tell the story of Alexander Hamilton, one of the founding fathers of the United States, who died in a duel in 1804.
The character raps in the show: "I imagine death so much it feels more like a memory/When is it gonna get me?"
Desert Island Discs host Lauren Laverne asked whether his idols - such as Hamilton, Rent writer Jonathan Larson, who died at the age of 35, and late Cabaret choreographer and director Bob Fosse - were connected because their stories all contain "the ticking clock".
'Six months of grey'
Miranda replied: "I think you're marked by your awareness of it and how much you let it affect your day-to-day.
"Part of it is growing up in New York. You're kind of always a little on alert. And I also experienced death at a young age."
Speaking about the death of his kindergarten friend, he said: "It's one of those terrible stories where each of the parents thought she was with someone else, and she drowned in the lake behind their home.
"I have this memory of nursery school of just six months of grey - of my friend, who used to go to this class, didn't go any more. And I remember the morning my mother told me. When that hits you early, you're aware of the ticking clock earlier."
Miranda's career has also included roles in Mary Poppins Returns and the forthcoming BBC adaptation of Philip Pullman's His Dark Materials. He is also currently making a film version of his first Broadway musical, In The Heights.