code: public static String randomString(int len, Random random) {
          if (len < 1) {
              return "";
          }
          int start = ' ';
          int end = 'z' + 1;
  
          StringBuffer buffer = new StringBuffer();
          int gap = end - start;
  
          while (len-- != 0) {
              char ch;
              ch = (char) (random.nextInt(gap) + start);
  
              if (Character.isLetterOrDigit(ch)) {
                  buffer.append(ch);
              } else {
                  len++;
              }
          }
          return buffer.toString();
      }
docs: Returns a random string of a certain length