MATLAB: Random numbers without repetition

random

X=1 2 3 4 5 6 7 8 9 10
Y=[1 3 4;1 6 9;6 7 8] o Y=[1 3 5;6 8 6;1 5 3] x Like this numbers of each row should be generated randomly with no repetition And no rows should have numbers
Help!

Best Answer

This is a simple (but inefficent) way to do it using UNIQUE:
Y = [];
while size(Y,1) ~= 3
Y = unique([Y ; randsample(10,3)'],'rows');
end;
Y = Y(randperm(size(Y,1)),:) %<-- To remove the sorting done by UNIQUE