it could just be chance, like with real shiny pokemon, but possibly a better chance since
A)you can only get the costume once, and
B)there aren't infinite costumes in the game, unlike wild pokemon
If you're in a battle against a ditto and you have a smeargle out that only knows sketch and the ditto uses transform then you waste your turn then attack next turn with sketch (going first) then ditto uses sketch will the ditto know sketch?