Home > Back-end >  Sui shu ji
Sui shu ji

Time:01-08

Define method returns a String type, according to the length of the generated random number String getRandom (int length); For example: getRandom (10) returns a string for example: random number "6125485787"

CodePudding user response:

String getRandom (int length) {
The Random rd=new Random ();
String a="";
for(int i=0; iA +=rd. NextInt (length);
}
return a;
}
  • Related