Returns a random string of the given length.
485626
def randomize(length=6, choices=None):
    """"""
    if type(choices) == str:
        choices = list(choices)
    choices = choices or ascii_lowercase
    return "".join(choice(choices) for _ in range(length))
208579
def random_str(Nchars=6, randstrbase='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'):
    
    return ''.join([randstrbase[random.randint(0, len(randstrbase) - 1)] for i in range(Nchars)])
863716
public static String randomAsciiFixLength(int length) {
		return RandomStringUtils.random(length, 32, 127, false, false, null, threadLocalRandom());
	}
1091575
def _randomString():
    """"""

    return ''.join(
        random.choice(string.ascii_uppercase + string.digits)
        for x in range(10))
1078518
static function getRandomString($length = 8)
    {

        $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';

        $value = '';
        $charsLength = strlen($chars) - 1;

        for ($i = 1 ; $i <= $length; $i++) {
            $value .= $chars[rand(0, $charsLength)];
        }

        return $value;

    }
522397
function randomString (length) {
    length = length || 6;

    var result = [],
        i;

    for (i = 0; i < length; i++) {
        result[i] = ASCII_SOURCE[(Math.random() * ASCII_SOURCE_LENGTH) | 0];
    }

    return result.join(EMPTY);
}
4370
function randomString() {
    var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 8;
    var charset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'abcdefghijklmnopqrstuvwxyz';

    var text = '';
    for (var i = 0; i < length; i++) {
        text += charset.charAt(Math.floor(Math.random() * charset.length));
    }return text;
}
10717
public static String randomString(int length) {
	StringBuilder sb = new StringBuilder();
	for (int i = 0; i < length; i++) {
	    sb.append(chars[AbstractCaptcha.rnd(0, chars.length - 1)]);
	}
	return sb.toString();
    }
269118
def random_strings(self, string_length=1):
        
        str_list = []
        for path in self.uniform_generate(string_length):
            str_list.append(self._path_to_str(path))
        return str_list
673287
def rand_ascii_str(length):
    
    letters = [random.choice(ascii_letters_and_digits) for _ in range(length)]
    return ''.join(letters)
348753
def rand_hexstr(length, lower=True):
    
    if lower:
        return rand_str(length, allowed=CHARSET_HEXSTR_LOWER)
    else:
        return rand_str(length, allowed=CHARSET_HEXSTR_UPPER)
834989
public function random_string($length = 32)
    {
        return substr(str_shuffle(str_repeat(
            $x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
            ceil($length / strlen($x))
        )), 1, $length);
    }
1263558
function randomString(length, chars) {
  length = length || 8;
  chars = chars || '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  var result = '';
  for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)];
  return result;
}
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)))
575778
function randomString(_string_length, _mode) {
    
    var string_length = _string_length;
    if(string_length < 3)
    	string_length = 2;
    
    var chars = chars_all;
    
    if(_mode === 'lower_case') chars = chars_lower;
    else if(_mode === 'upper_case') chars = chars_upper;
    else if(_mode === 'nums_oly') chars = chars_nums;
    else if(_mode === 'especials') chars = chars_all + chars_spec;
    
    var str = '';
    for (var i=0; i<string_length; i++) {
        var rnum = Math.floor(Math.random() * chars.length);
        str += chars.substring(rnum,rnum+1);
    }
    
    return str;
}
993241
public static String getRandomString(final int stringLength) {

    StringBuilder stringBuilder = getStringBuild();
    for (int i = 0; i < stringLength; i++) {
      stringBuilder.append(getRandomAlphabetic());
    }
    return stringBuilder.toString();
  }
230738
function randomString() {
    var str = '', length = 32;
    while (length--) {
        str += String.fromCharCode(Math.random() * 26 | 97);
    }
    return str;
}