title: How do i complete this question with 2-dimensional array in java?
body: <p>Hey guys, im working through the Introduction to Programming in Java book and one of the exercises is this:</p>
  
  <blockquote>
    <p><strong>Empirical shuffle check</strong>. Run
    computational experiments to check
    that our shuffling code works as
    advertised. Write a program
    ShuffleTest that takes command-line
    arguments M and N, does N shuffles of
    an array of size M that is initialized
    with a[i] = i before each shuffle, and
    prints an M-by-M table such that row i
    gives the number of times i wound up
    in position j for all j. All entries
    in the array should be close to N/M.</p>
  </blockquote>
  
  <p>Now, this code just outputs a block of zeros...</p>
  
  <pre><code>public class ShuffleTest2 {
    public static void main(String[] args) {
      int M = Integer.parseInt(args[0]);
      int N = Integer.parseInt(args[1]); 
      int [] deck = new int [M];
  
      for (int i = 0; i &lt; M; ++i)
        deck [i] = i;
  
      int [][] a = new int [M][M];
  
      for (int i = 0; i &lt; M; i++) {
        for (int j = 0; j &lt; M; j++) {
          a[i][j] = 0 ;
  
          for(int n = 0; n &lt; N; n++) {
            int r = i + (int)(Math.random() * (M-i));
            int t = deck[r];
            deck[r] = deck[i];
            deck[i] = t;
  
            for (int b = 0; b &lt; N; b++)
            {
              for (int c = 0; c &lt; M; c++)
                System.out.print(" " + a[b][c]);
              System.out.println();
            }
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>What am i doing wrong? :(</p>
  
  <p>Thanks</p>