I used to do a very stupid magic trick where I would have someone pick a card and then shuffle it back into the deck. I would shuffle a few more times while asking them to focus on their card. Then I would ask them to name their card. They did. I would put down the deck and say "not only have I found your Ten of Clubs..." and then I would look at the top card and finish with "...but I have changed it into the Ace of Spades".
Every once in a while, purely by luck, the correct card would be at the top. In which case I would just change the second line to "...but I have brought it to the top of the deck for you". My sister begged me to tell her how I did it for years.
Dai Vernon had something akin to that. I -assume- it was the serendipitous case you mention, but it is, after all, anecdote, so it might have been something more. But, pulling from Wikipedia - 'He also had an encounter with another up-and-coming young magician from his town, Cliff Green, who asked Vernon, "What kind of magic do you do?" Vernon responded by asking the boy to name a card. Upon pulling a pack of cards from his pocket, Vernon turned over the top card of the deck to reveal the named card and replied to Green "That's the kind of magic I do. What kind of magic do you do?" '
Every once in a while, purely by luck, the correct card would be at the top. In which case I would just change the second line to "...but I have brought it to the top of the deck for you". My sister begged me to tell her how I did it for years.