I want to generate a 6 character random string on every compilation of a program in Java.
For example: AXFGCD, GDGXSD, PLRSFX, GLTSDL
public class generate{
public static void main(String args[]){
generate();
}
string word = "";
string Characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
void generate(int x){
if (x==7) return;
int time = System.currentTimeMillis() % 33; //to generate time in mili second
word += characters.charAt(time);
System.out.println(time);
return generate(++x);
}
}
output is
A,AX,AXF,AXFC,AXFCG,AXFCGA
but I want direct 6 digit word