generateRandomNumber function

int generateRandomNumber(
  1. int length
)

生成随机数

Implementation

int generateRandomNumber(int length) {
  final Random random = Random();
  final minValue = pow(10, length - 1).toInt();
  final maxValue = pow(10, length).toInt() - 1;
  final randomNumber = minValue + random.nextInt(maxValue - minValue + 1);
  return randomNumber;
}