This question already has an answer here:
- Generating Unique Random Numbers in Java 12 answers
here´s the part of code: Is a method,not main.
public static String generator(){
Random gen=new Random();
String pwrd="";
for(int i=0;i<4;i++){
int num=gen.nextInt(6);
pwrd+=num;
}
return pwrd;
Aucun commentaire:
Enregistrer un commentaire