MATLAB: Reordering the data

reordering

i have values as
D=[1 2 3 4 5 6 7 ]
now i want to reorder the data
D1=[3 4 7 1 2 6 5]this is for example,
i want the order to be changed from D,without using randperm function,please help

Best Answer

What about generating two random numbers as indices and swapping the data of the indices? And then do this in a loop.
clc
D=[1 2 3 4 5 6 7 ]
for k=1:10
x1=randi(length(D));
x2=randi(length(D));
dummy=D(x1);
D(x1)=D(x2);
D(x2)=dummy
end