Let $M$ be an $n \times m$ matrix, with $1, \dots, m$ in the first row, $m+1, \dots, 2m$ in the second row, etc.
$$M = \left[ \begin{array}{c} 1 & 2 & \dots & m \\ m+1 & m+2 & \dots & 2m \\ & & \dots & \\ (n-1)m + 1 & (n-1)m + 2 & \dots & nm \end{array} \right] $$
I want to shuffle this matrix using only two kinds of operations:
- Column shifts, where a shift of column $j$ by $s$ moves the element at $(i, j)$ to $(i + s \bmod{n}, j)$, for $i \in [n]$.
- Row shifts, where a shift of row $i$ by $s$ moves each element at $(i, j)$ to $(i, j+s\bmod{m})$, for $j \in [m]$.
(A row / column shift affects one row / column, not all of them.)
My goal is not necessarily to achieve a full shuffle; rather, it is to ensure that any $n$ elements are equally likely to be in the same column. (However, correlations across columns - where perhaps $n$ elements $y_1, \dots, y_n$ share a column iff elements $x_1, \dots, x_n$ share a column - are allowed.)
How many random shifts (column / row shifts with random $s$) do I need to perform before my matrix is "shuffled enough" (as described above)? What is the minimal shuffling algorithm (which columns $j$ and rows $i$ do I randomly shift)?
Any hints to relevant literature would be appreciated. Thank you in advance!