randomAlphaNumeric method

String randomAlphaNumeric(
  1. int count
)

Implementation

String randomAlphaNumeric(int count) {
  const String ALPHA_NUMERIC_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
  String key = "";
  Random random = Random();
  while (count-- != 0) {
    int character = random.nextInt(ALPHA_NUMERIC_STRING.length - 1);
    key += ALPHA_NUMERIC_STRING[character];
  }
  return key;
}