lundi 10 juin 2019

Is there an efficient way to apply different permutations for each rows of a matrix

Given a matrix A, I want to apply different random shuffles for different row of A; for example, [[1,2,3],[4,5,6],[7,8,9]] becomes [[1,3,2],[6,5,4],[7,9,8]].

Of course we can loop through the matrix and make every row randomly shuffle; however iteration is slow and I am asking if there is more efficient way to do this.




Aucun commentaire:

Enregistrer un commentaire