title: java random generator without repeat
body: <p>Im trying to generate a 2d array using a random generator.  basically, each column should contain a random value between 1-50 that is not repeated but the problem is, I can't get a repeat value on the same row, or any other row or column in the program.  In other words, each I integer should only display once.  My objects were created via linked list and I will probably integrate the algorthim in there once I figure it out but for now, heres what I did.</p>
  
  <pre><code>int[] array = new int[50];
  
  
  
          for(int i=1;i&lt;=9;i++)
          {
  
          int[] grades = new int[5];
              for(int j=0;j&lt;=4;j++)
              {
  
              int unique = gen.nextInt(50)+1;
  
  
              grades[j] = unique; 
              }
              list.add(new Student(i, grades));
  
          }
  
          System.out.println(list);
  </code></pre>
  
  <p>My output:</p>
  
  <pre><code>Student1: 20 49 45 16 13 
  Student2: 28 10 11 30 6 
  Student3: 13 25 37 31 49 
  Student4: 8 23 8 12 32 
  Student5: 22 18 35 2 7 
  Student6: 35 8 16 23 36 
  Student7: 35 3 15 42 2 
  Student8: 43 12 44 2 35 
  Student9: 12 21 36 23 12 
  </code></pre>
  
  <p>So my issue is this.  How can I implement the random gen without repeating values.  Normally I would try a collection list by now, but I'm trying to do this using java.util.Random  Personally, I would do this a different way but I'm instructed.  Thank you</p>