is there any other method to create a random order of character java with every character and with out dublicate? like without importing random class
public static String Ra(double jav){
Random in = new Random();
String ans = "";
for (int j = 0; j < jav;) {
char x = (char) (in.nextInt(26) + 'A');
if(!ans.toString().contains(""+x)){
ans = ans +x;
j++;
}
}
return ans;
}
Aucun commentaire:
Enregistrer un commentaire