Prompts the user for a random string.
515308
def ask_captcha(length=4):
    """"""
    captcha = "".join(random.choice(string.ascii_lowercase) for _ in range(length))
    ask_str('Enter the following letters, "%s"' % (captcha), vld=[captcha, captcha.upper()], blk=False)
288203
def _make_random_string(length):
    
    chars = string.ascii_lowercase + string.ascii_uppercase + string.digits
    return ''.join(random.choice(chars) for x in range(length))
683468
def random(self):
        
        utc_now = datetime.datetime.utcnow()
        return self.valueFromString(utc_now.strftime(self.defaultFormat()))
206680
def random_string_in(arr)
      return nil if arr.empty?
      index = random_number(0, arr.length-1)
      arr[index]
    end
276360
def randstring(length=1):
    
    charstouse = string.ascii_letters + string.digits + string.punctuation
    newpass = ''
    for _ in range(length):
        newpass += str(charstouse[random.randint(0, len(charstouse) - 1)])
    return newpass
928148
def make_dynamic_prompt(self, prompt):
        """"""
        if prompt:
            self.prompt_re = self.driver.make_dynamic_prompt(prompt)
560530
def choice_prompt(prompt, choices=None, choice=None):
    '''
    
    '''
    if not choices:
        choices = ["y", "n", "Y", "N"]

    print(prompt)
    get_input = getattr(__builtins__, 'raw_input', input)
    pretty_choices = '/'.join(choices)
    message = 'Please enter your choice [%s] : ' %(pretty_choices)
    while choice not in choices:
        choice = get_input(message).strip()

        # If the option isn't valid, this is shown next
        message = "Please enter a valid option in [%s]" %(pretty_choices)    
    return choice
259698
public static String randomString(String baseString, int length) {
		final StringBuilder sb = new StringBuilder();

		if (length < 1) {
			length = 1;
		}
		int baseLength = baseString.length();
		for (int i = 0; i < length; i++) {
			int number = getRandom().nextInt(baseLength);
			sb.append(baseString.charAt(number));
		}
		return sb.toString();
	}
66330
def generate_random_string(length=6):
    '''
    
    '''
    n = int(length / 2 + 1)
    x = binascii.hexlify(os.urandom(n))
    s = x[:length]
    return s.decode('utf-8')
556966
def _random_id(self, size=16, chars=string.ascii_uppercase + string.digits):
        
        return ''.join(random.choice(chars) for _ in range(size))
169922
def generate_random_string(length=8):
    
    char_set = string.ascii_uppercase + string.digits
    return ''.join(random.sample(char_set * (length - 1), length))
1058702
def gen_random_string(str_len):
    
    return ''.join(
        random.choice(string.ascii_letters + string.digits) for _ in range(str_len))
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)))
862847
def create_random_string(length=7, chars='ABCDEFGHJKMNPQRSTUVWXYZ23456789',
                         repetitions=False):
    
    if repetitions:
        return ''.join(random.choice(chars) for _ in range(length))
    return ''.join(random.sample(chars, length))
1204522
def randomString(length, chrs=None):
    """"""
    if chrs is None:
        return getBytes(length)
    else:
        n = len(chrs)
        return ''.join([chrs[randrange(n)] for _ in xrange(length)])
628142
def _get_random_string(length=44,
                       allowed_chars='abcdefghijklmnopqrstuvwxyz'
                       'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
                       secret_key=settings.secret_key_bytes()):
    
    secret_key = _ensure_bytes(secret_key)
    _reseed_if_needed(using_sysrandom, secret_key)
    return ''.join(random.choice(allowed_chars) for i in range(length))
967819
public static String randomString( char[] values, int len )
    {
        Random rnd = new SecureRandom();
        StringBuilder sb = new StringBuilder( len );
        for ( int i = 0; i < len; i++ ) {
            sb.append( values[ rnd.nextInt( values.length )] );
        }
        return sb.toString();
    }