I think improvisation is not just random pick of melodies. Improvisation has its own structures, sentences, words.
The reason that we call it improvisation is that because we are free to select which structure, sentence, or word at a particular moment. Once selected, it will have a structure. It become a melody.