Copy Code code as follows:
public static void Main (string[] args) {
String s = randomnum.getrandomnumstr (5);
System.out.println (s);
System.out.println ("Generate 5 strings containing 5 characters:");
Randomnum.suijizifuchuan (5,5);
System.out.println ("Generate 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: