/*I am trying to generate 6 random unique (1-49) no.s and understand that my validation is incorrect.Help Please?*/
import java.util.*;
import javax.swing.JOptionPane;
public class ranUnique {
public static void main(String[] args) {
String output="";
int[] arrayRan=new int[6];int ran2;
for(int ran=0;ran<arrayRan.length;ran++){
arrayRan[ran]=(int)(Math.random()*50
//validate
for(ran2=0;ran2<=ran;ran2++){
if ((arrayRan[ran]==arrayRan[ran2]) || (arrayRan[ran]==0)) {
arrayRan[ran]=(int)(Math.random()...
//ran=ran-1;
}
}
}
Arrays.sort(arrayRan);
for(int sort=0;sort<arrayRan.length;sort++){
output=output+ arrayRan[sort]+" ";
}
JOptionPane.showMessageDialog(null,ou...
}
}