CodePudding user response:
public class NumberTest {
Public static void main (String [] args) throws the Exception {
The String result=Character. ToString ((char) generateNumberInRange (97, 122));
For (int I=1; I & lt;=4; I++) {
The result +=generateNumberInRange (0, 9);
}
System. The out. Println (result);
}
Private static int generateNumberInRange (int min, int Max) {
If (min & gt;=Max) {
Throw new IllegalArgumentException (" invalid range ");
}
The Random r=new Random ();
Return r.n extInt ((Max - min) + 1) + min;
}
}