Generate a series of random characters.

    Kwargs:
        number_of_random_chars (int) : Number of characters long
        character_set (str): Specify a character set.  Default is ASCII
332283
def generate_random_string(number_of_random_chars=8, character_set=string.ascii_letters):
    
    return u('').join(random.choice(character_set)
                      for _ in range(number_of_random_chars))
833291
def random_letter(self):
        """"""
        return self.generator.random.choice(
            getattr(string, 'letters', string.ascii_letters))
815013
def random_string(length=6, alphabet=string.ascii_letters+string.digits):
    
    return ''.join([random.choice(alphabet) for i in xrange(length)])
1010726
public static String generateRandomKey (Random rand, int length)
    {
        int numKeyChars = KEY_CHARS.length();
        StringBuilder buf = new StringBuilder();
        for (int ii = 0; ii < length; ii++) {
            buf.append(KEY_CHARS.charAt(rand.nextInt(numKeyChars)));
        }
        return buf.toString();
    }
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;
}
731031
def random_string(random_length=None):
    
    choices = string.letters + ' '
    text = []
    if not random_length:
        random_length = random.randint(1, 30)
    for x in range(random_length):
        text.append(random.choice(choices))
    return "".join(text)
562786
public static String generateCharsSymbolsString(int lenght) {
        StringBuffer buf = new StringBuffer(lenght);
        SecureRandom rand = new SecureRandom();
        for (int i = 0; i < lenght; i++) {
            buf.append(charsSymbols[rand.nextInt(charsSymbols.length)]);
        }
        return buf.toString();
    }
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);
}
856508
def _generate_random_word(self, length):
        
        return ''.join(random.choice(string.ascii_lowercase) for _ in range(length))
401361
def make_random_key() -> Text:
    

    r = SystemRandom()
    allowed = \
        'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+/[]'

    return ''.join([r.choice(allowed) for _ in range(0, 50)])
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))
1372997
public static final String generateHex(final Random random, final int characters)
	{
		if (characters < 1)
			throw new IllegalArgumentException("characters must be >= 1");

		final char[] str = new char[characters];

		for (int i = 0; i < characters; i++)
		{
			str[i] = hex[random.nextInt(16)];
		}

		return new String(str);
	}
319800
def random_id(length):
    """"""

    def char():
        """Generate single random char"""

        return random.choice(string.ascii_letters + string.digits)

    return "".join(char() for _ in range(length))
630517
public static String generateRandomString(int length) {

        char[] chars = "abcdefghijklmnopqrstuvwxyz1234567890".toCharArray();
        StringBuilder sb = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < 20; i++) {
            char c = chars[random.nextInt(chars.length)];
            sb.append(c);
        }

        return sb.toString();
    }
1138245
def generate_random_string(cls, length):
        
        # avoid things that could be mistaken ex: 'I' and '1'
        letters = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ"
        return "".join([random.choice(letters) for _ in range(length)])
1250953
def generate_key(key_length=64):
    
    if hasattr(random, 'SystemRandom'):
        logging.info('Generating a secure random key using SystemRandom.')
        choice = random.SystemRandom().choice
    else:
        msg = "WARNING: SystemRandom not present. Generating a random "\
              "key using random.choice (NOT CRYPTOGRAPHICALLY SECURE)."
        logging.warning(msg)
        choice = random.choice
    return ''.join(map(lambda x: choice(string.digits + string.ascii_letters),
                   range(key_length)))
549000
def generate(number=4, choice=SystemRandom().choice, words=words, joiner=" "):
    
    return joiner.join(choice(words) for each in range(number))