src/main/java/org/jivesoftware/smack/util/StringUtils.java
public static String randomString(int length) {
        if (length < 1) {
            return null;
        }
        // Create a char buffer to put random letters and numbers in.
        char[] randBuffer = new char[length];
        for (int i = 0; i < randBuffer.length; i++) {
            randBuffer[i] = numbersAndLetters[randGen.nextInt(71)];
        }
        return new String(randBuffer);
    }
public static String randomString(int length) {
        if (length < 1) {
            return null;
        }
        // Create a char buffer to put random letters and numbers in.
        char[] randBuffer = new char[length];
        for (int i = 0; i < randBuffer.length; i++) {
            randBuffer[i] = numbersAndLetters[randGen.nextInt(71)];
        }
        return new String(randBuffer);
    }
Returns a random String of numbers and letters (lower and upper case) of
the specified length. The method uses the Random class that is built-in
to Java which is suitable for low to medium grade security uses. This
means that the output is only pseudo random, i.e., each number is
mathematically generated so is not truly random.
<p>

The specified length must be at least one. If not, the method will return
null.

@param length
the desired length of the random String to return.
@return a random String of numbers and letters of the specified length.