We use the correlation matrix of the generating distribution to determine the mixing time for random walks on the torus $$(\mathbb {Z}/q\mathbb {Z})^n$$ ( Z / q Z ) n . We present our method in the context of the Diaconis–Gangolli random walk on both the $$1 \times n$$ 1 × n and $$m \times n$$ m × n contingency tables over $$\mathbb {Z}/q\mathbb {Z}$$ Z / q Z . In the $$1 \times n$$ 1 × n case, we prove that the random walk exhibits cutoff at time $$\dfrac{n q^2 \log (n)}{8 \pi ^2}$$ n q 2 log ( n ) 8 π 2 when $$q \gg n$$ q ≫ n ; in the $$m \times n$$ m × n case, where m and n are of the same order, we establish cutoff for the random walk at time $$\dfrac{mn q^2 \log (mn)}{16 \pi ^2}$$ m n q 2 log ( m n ) 16 π 2 when $$q \gg n^2$$ q ≫ n 2 . Our method reveals that a general class of random walks on the torus $$(\mathbb {Z}/q\mathbb {Z})^n$$ ( Z / q Z ) n has cutoff. If each coordinate of the