public static String generateString(int length) {

		if (length <= 0 || length > 100) {
			throw new IllegalArgumentException("Can't generate random id with length: " + length);
		}

		SecureRandom random = new SecureRandom();
		StringBuilder sb = new StringBuilder(length);
		for (int i = 0; i < length; i++) {
			sb.append(ELEMENTS.charAt(random.nextInt(ELEMENTS.length())));
		}

		return sb.toString();
	}
public static String generateString(int length) {

		if (length <= 0 || length > 100) {
			throw new IllegalArgumentException("Can't generate random id with length: " + length);
		}

		SecureRandom random = new SecureRandom();
		StringBuilder sb = new StringBuilder(length);
		for (int i = 0; i < length; i++) {
			sb.append(ELEMENTS.charAt(random.nextInt(ELEMENTS.length())));
		}

		return sb.toString();
	}
public static String generateString ( int length ) { if ( length <= 0 || length > 100 ) { throw new IllegalArgumentException ( "Can't generate random id with length: " + length ) ; } SecureRandom random = new SecureRandom ( ) ; StringBuilder sb = new StringBuilder ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { sb . append ( ELEMENTS . charAt ( random . nextInt ( ELEMENTS . length ( ) ) ) ) ; } return sb . toString ( ) ; }
Generates random string from ELEMENTS set of chars and numbers

@param length desired length of key greater than 0
@return random string of desired length (min 1, max 100 characters long)
Generates random string from ELEMENTS set of chars and numbers