Randomly permute rows/columns of a matrix with eigen
Using std::random_shuffle is perfectly fine, then you have to use a PermutationMatrix:
PermutationMatrix<Dynamic,Dynamic> perm(size);
perm.setIdentity();
std::random_shuffle(perm.indices().data(), perm.indices().data()+perm.indices().size());
A_perm = A * perm; // permute columns
A_perm = perm * A; // permute rows