If you need to specify the exact charactor length, we have to avoid values with 0 in-front.
Final String representation must have that exact character length.
String GenerateRandomNumber(int charLength) {
return String.valueOf(charLength < 1 ? 0 : new Random()
.nextInt((9 * (int) Math.pow(10, charLength - 1)) - 1)
+ (int) Math.pow(10, charLength - 1));
}