Here is a new answer, based on the comments on the other answers.
indexRepeat = randperm(numberTotal,numberRepeat);
y(indexRepeat) = x(indexRepeat);
This code will replace a fixed number of elements, but the positions that are replaced will be random. If you need to replace a random number of elements, then use something like
numberRepeat = randi([3,5]);
which will repeat 3, 4, or 5 elements.