Keith Richard admits that the song happened out of chance, since they were booked in a recording studio directly after Led Zeppelin.

Source: Billboard