I have a matrix as follows.
mat = [[23,45,56,67],
[12,67,09,78],
[20,59,48,15],
[00,06,51,90]]
I want to write a function where depending on the argument passed to the function, the rows of the matrix must be shifted and shuffled. For eg: if the argument passed to the function is 2, then the 2nd row of the matrix mat
must be made as 0th row while the rest of the rows 1-3 must be shuffled as shown below.
value = 2
mat = [[20,59,48,15],
[00,06,51,90],
[23,45,56,67],
[12,67,09,78]]
The rows 1-3 in the above matrix should be randomly shuffled. One example of how the matrix should look like is shown above.
Is there a way to write a function for this?
Thanks!