It turns out that you can rush perfection, at least in the case of these 20 iconic rock songs that were written on the spot.

At least that was the case for the rock masterminds behind the Rolling Stones, the Police, and the Beatles, who all wrote some of their biggest hits on the spot. Some musical prodigies literally wrote hits in their sleep, such as Keith Richards, Sting, and Paul McCartney. Other bangers emerged during practice sessions that turned fingerpicking riffs into songs that have endured throughout the decades like Kansas’ 1977 soft rock hit “Dust in the Wind.”

Rock music, with its array of genres and ability to channel authentic emotions, is especially prime for spontaneous inspiration. Likewise, the most effective songwriting strategies vary widely: Guns N’ Roses completed “Sweet Child O’ Mine” in under a day, while “November Rain” reportedly took Axl Rose eight years to finish.

READ MORE: The 10 Creepiest Music Videos of All Time

Of course, each moment of musical inspiration is preceded by countless hours of practice and discipline. But in briefly trusting a creative impulse—and following where it leads—these artists topped Billboard charts, won Grammys, and earned their footholds in the annals of rock history.

Consulting historical records, music charts, and magazine interviews, Stacker looked at 20 iconic rock songs written on the spot.

20 Iconic Rock Songs Written on the Spot

Stacker compiled a list of 20 iconic rock songs written on the spot, consulting historical records, music charts, and magazine interviews.

Gallery Credit: Colleen Kilday

10 Alternative Rock Songs Written Under the Influence of Alcohol or Drugs

Drugs are a part of life. They are also a part of rock — even alternative rock. So because heavy metal and classic rock already have so many inebriated tales of their own, here are a few from the alt-rock end of things.

Gallery Credit: Philip Trapp