The code copy is as follows:
public static void main(String[] args) {
//String s = RandomNum.getRandomNumStr(5);
//System.out.println(s);
System.out.println("generates 5 strings containing 5 characters:");
RandomNum.SuiJiZiFuChuan(5,5);
System.out.println("generates 3 strings containing 6 characters:");
RandomNum.SuiJiZiFuChuan(6,3);
System.out.println("Generate any 1 to 20 strings containing any 1 to 10 characters:");
RandomNum.SuiJiZiFuChuan((int)(20*Math.random()),(int)(10*Math.random()));
System.out.println("Random generation character:");
int i=0;
while(i<(int)(10*Math.random())){
RandomNum.SuiJiZiFuChuan((int)(20*Math.random()),1);
i++;
}
}
public static void SuiJiZiFuChuan(int x,int y){
for(int j=0;j<y;j++){
for(int i=0;i<x;i++){
int a=(int)(100*Math.random()+100*Math.random());
while(true){
if(a>96&a<123)
break;
else
a=(int)(100*Math.random()+100*Math.random());
}
System.out.print((char)a);
}
System.out.println();
}
}
Execution results: