MATLAB: Re-generate random matrix

distribute a matrix randomly

Hi
I have a matrix A (9X9) and I want to generate a new matrix B using the same matrix of A and should be distributed randomly and each number should be used once to generate matrix B.

Best Answer

ind=randperm(81)
B=reshape(A(ind),9,9)