@Andrey, you could accomplish this using the 2nd output of randswap:
a = reshape(1:25,5,5)
[ra,i] = randswap(a,1) % swap rows
ra = ra.' ; % transpose (columns become rows)
ra = ra(i) ; % swap rows again
ra = ra.' ; transpose again
For QAP, I need to scramble rows and columns of the adjacency matrix in exactly the same way. It would be nice if there was an option to apply the same permutation to both dimensions for scrambling square matrices.
Thank you for this great function!
Would it be possible to update the function with an argument specifying distribution also?
I suppose randomization is done according to uniform distribution. It would be great if it works also with other, e.g. normal, binomial, poisson, inverse of normal etc.
Thank you!
Comment only