how to return random string Arrray Java
<p>I am very new to Java, so this could seem too easy for most people....Is this completely wrong?
My question is how to write a method <code>selectRandom(String[] names)</code>,
which returns a randomly selected name from the given array. </p>

<p>Each name should be selected with equal probability. </p>

<pre><code>public static String selectRandom(String[] names)    
{    
    String num = names[0]; 
    int[]newArray = new int[names.length];
    for(int i =0; i&lt;names.length;i++)
    {
      Random r = new Random();
      int ranNum= r.nextInt(names.length)+1;
      num = names[ranNum];
    }
    return num;  
}
</code></pre>
