Create a new {@link StringRandomizer}.

@param charset   to use
@param maxLength of the String to generate
@param minLength of the String to generate
@param seed      initial seed
@return a new {@link StringRandomizer}.
975185
public static StringRandomizer aNewStringRandomizer(final Charset charset, final int minLength, final int maxLength, final long seed) {
        if (minLength > maxLength) {
            throw new IllegalArgumentException("minLength should be less than or equal to maxLength");
        }
        return new StringRandomizer(charset, minLength, maxLength, seed);
    }
1024998
public String randomString(String permitted, int length) {
        StringBuilder result = new StringBuilder(length);
        int maxIndex = permitted.length();
        for (int i = 0; i < length; i++) {
            int index = random(maxIndex);
            char value = permitted.charAt(index);
            result.append(value);
        }
        return result.toString();
    }
356251
public static String getRandomString(final int size, final int start, final int length) {
		final StringBuilder buff = new StringBuilder(size);

		for (int i = 0; i < size; i++) {
			buff.append((char) (RAN.nextInt(length) + start));
		}
		return buff.toString();
	}
1219053
public static String getRandomAlphaNumeric(int length) {
        if (length <= 0) {
            return "";
        }

        Random r = getRandom();

        StringBuffer result = new StringBuffer(length);

        for (int i = 0; i < length; i++) {
            int n = r.nextInt(alphaNumChars.length);
            result.append(alphaNumChars[n]);
        }

        return result.toString();
    }
331271
def random(length, chars=None):
    
    if chars is None:
        chars = string.ascii_letters + string.digits
    else:
        ensure_string(chars)
        if not chars:
            raise ValueError("character set must not be empty")

    if is_pair(length):
        length = randint(*length)
    elif isinstance(length, Integral):
        if not length > 0:
            raise ValueError(
                "random string length must be positive (got %r)" % (length,))
    else:
        raise TypeError("random string length must be an integer; "
                        "got '%s'" % type(length).__name__)

    return join(chars.__class__(), (choice(chars) for _ in xrange(length)))
386274
public static String randomString(Long numberOfLetters, String notationMethod, boolean useNumbers, TestContext context) {
        return new RandomStringFunction().execute(Arrays.asList(String.valueOf(numberOfLetters), notationMethod, String.valueOf(useNumbers)), context);
    }
95435
public static DateRangeRandomizer aNewDateRangeRandomizer(final Date min, final Date max, final long seed) {
        return new DateRangeRandomizer(min, max, seed);
    }
615859
public static int getRandomInteger(int min, int max) {
		Random r = new Random();
		return r.nextInt(max - min + 1) + min;
	}
1338665
public static ContentType create(final String mimeType, final Charset charset) {
        if (mimeType == null) {
            throw new IllegalArgumentException("MIME type may not be null");
        }
        String type = mimeType.trim().toLowerCase(Locale.US);
        if (type.length() == 0) {
            throw new IllegalArgumentException("MIME type may not be empty");
        }
        if (!valid(type)) {
            throw new IllegalArgumentException("MIME type may not contain reserved characters");
        }
        return new ContentType(type, charset);
    }
851394
public static String getRandom(char[] sourceChar, int length) {
        if (sourceChar == null || sourceChar.length == 0 || length < 0) {
            return null;
        }
        StringBuilder str = new StringBuilder(length);
        Random random = new Random();
        for (int i = 0; i < length; i++) {
            str.append(sourceChar[random.nextInt(sourceChar.length)]);
        }
        return str.toString();
    }
1089749
public String getRandomText(final int minLength, final int maxLength) {
    validateMinMaxParams(minLength, maxLength);

    StringBuilder sb = new StringBuilder(maxLength);
    int length = minLength;
    if (maxLength != minLength) {
      length = length + random.nextInt(maxLength - minLength);
    }
    while (length > 0) {
      if (sb.length() != 0) {
        sb.append(" ");
        length--;
      }
      final double desiredWordLengthNormalDistributed = 1.0 + Math.abs(random.nextGaussian()) * 6;
      int usedWordLength = (int) (Math.min(length, desiredWordLengthNormalDistributed));
      String word = getRandomWord(usedWordLength);
      sb.append(word);
      length = length - word.length();
    }
    return sb.toString();

  }
96646
public static long randomLong(final long min, final long max) {

        return Math.round(Math.random() * (max - min) + min);
    }
871834
function generateRandomString(length) {
	let s = "";
	let i = length;
	while (length-- > 0) {
		let c = Math.floor(Math.random() * (MAX_HEX_SYMBOL - MIN_HEX_SYMBOL + 1)) + MIN_HEX_SYMBOL;
		c = c.toString(16).toLowerCase();
		s += c;
	}
	return s;
}
1373291
public static String randomString(int length) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < length; i++) {
            int index = (int) random(0, ALL_CHAR.length() - 1);
            sb.append(ALL_CHAR.charAt(index));
        }
        return sb.toString();
    }
701554
public void setMaxLength(int length) {
		maxCharacter = length;
		if (value.length() > maxCharacter) {
			value = value.substring(0, maxCharacter);
		}
	}
1329540
public static String nextString(int min, int max) {
		StringBuilder result = new StringBuilder();

		int length = RandomInteger.nextInteger(min, max);
		for (int i = 0; i < length; i++) {
			int index = RandomInteger.nextInteger(_chars.length());
			result.append(_chars.charAt(index));
		}

		return result.toString();
	}
1210204
public static String generateMixString(int length) {
		StringBuffer sb = new StringBuffer();
		Random random = new Random();
		for (int i = 0; i < length; i++) {
			sb.append(allChar.charAt(random.nextInt(letterChar.length())));
		}
		return sb.toString();
	}