title: How to get a String array to equal another String array
body: <pre><code>String[] mySecret;
  String[] colours = {"R","Y","Bl","G","O","Pu","Pi","Br"};
  
  public void getuserInput() {
      numColours = min + (int)(Math.random() * ((max-min) +1));
      numPegs = min + (int)(Math.random() * ((max-min) +1));
  }
  public void setSecret() {
      for (i=0; i&lt;numColours; i++) {
          mySecret[i] = colours[new Random().nextInt(colours.length)];
      }
  }
  </code></pre>
  
  <p>This is a small part of my code. When I run this, I get a NullPointerException. Is there any other way to get mySecret which is meant to be a string array to contain a specified number of colours but chosen at random from the colours string array. Any help would be appreciated, thanks.</p>