My suggestion is to start with any valid vector according to your constraints. In the example below I have chosen the most obvious one which is 1,2,3,...,18,19,1,2,...
The next step is to move around the numbers in a way that always will end up with a valid vector but still introduces some randomness. One way to do that is to take a random index and switch place with its neighbor, if the move results in a vector which fulfills the constraints. Since we know that the old vector is valid it is only necessary to check exactly +- 10 indexes from the random position.
y = repmat(1:19,1,10);
for ii = 1:100000
index = randi(length(y)-1);
if y(index)~=y(min(index+10, length(y))) && y(index+1)~=y(max(1,index-9))
yTmp = y(index);
My code runs in ~0.5 s with 100 000 iterations, of which approximately 85 000 result in a valid move.