src/org/kocakosm/pitaya/util/Strings.java
public static String random(int length, Random rnd, char... chars)
	{
		Parameters.checkCondition(length >= 0);
		Parameters.checkCondition(chars.length > 0);
		StringBuilder sb = new StringBuilder(length);
		for (int i = 0; i < length; i++) {
			sb.append(chars[rnd.nextInt(chars.length)]);
		}
		return sb.toString();
	}
public static String random(int length, Random rnd, char... chars)
	{
		Parameters.checkCondition(length >= 0);
		Parameters.checkCondition(chars.length > 0);
		StringBuilder sb = new StringBuilder(length);
		for (int i = 0; i < length; i++) {
			sb.append(chars[rnd.nextInt(chars.length)]);
		}
		return sb.toString();
	}
Returns a random {@code String} using the given characters and the
specified source of randomness. All characters have equal likelihood
to appear in the resulting {@code String} assuming that the source of
randomness is fair.

@param length the length of the {@code String} to produce.
@param rnd the source of randomness to use.
@param chars the characters to use to build the {@code String}.

@return a random {@code String}.

@throws NullPointerException if one of the arguments is {@code null}.
@throws IllegalArgumentException if {@code length} is negative or if
{@code chars} is empty.