switching columns of a 2d array
<p>so my problem is that i cannot get the elements of a 2d array to switch like i would be able to do in a single variable array. Instead of switching the elements they are just being continuously rewritten... </p>

<pre><code>for (int column = 0; column &lt; m[0].length; column++) {
    shufcol = (int)(Math.random()*4);
    temp = column;
    System.out.println(shufcol);

    for(int row = 0; row &lt; m.length; row++) {
        temp = row;
        m[row][temp]=m[row][column];
        m[row][column]= m[row][shufcol];
        m[row][temp] = m[row][shufcol];
    }
}
</code></pre>

<p>input array (3X4)
{{0 1 2 3} 
{1 4 5 6} 
{0 7 8 9}}</p>

<p>output array
{{2 2 3 2} 
{5 5 6 5} 
{8 8 9 8}}</p>

<p>If your curious about the <code>math.random</code>, that is just to generate a random column between 0 to 3 to switch with. Again the issue is why is it only rewriting elements and not switching them? </p>
