generate a random string include uppercase and lowercase letters and numbers
515994
public function randomStr( $length = 16 )
    {
        $arr = array_merge(range(0, 9), range('a', 'z'), range('A', 'Z'));

        $str = '';
        $arr_len = count($arr);
        for ($i = 0; $i < $length; $i++)
        {
            $rand = mt_rand(0, $arr_len-1);
            $str.=$arr[$rand];
        }

        return $str;
    }
763275
function generator(n) {
  if (!n) return Date.now().toString(36).toUpperCase();
  return Math.random().toString(36).substring(2, 10).toUpperCase();
}
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
1040014
@Function
    public static String randomizeLetterCase(String text) {
        StringBuilder result = new StringBuilder();
        for (int i = 0; i < text.length(); i++) {
            char c = text.charAt(i);
            if (RANDOM.nextBoolean()) {
                c = toUpperCase(c);
            } else {
                c = toLowerCase(c);
            }
            result.append(c);
        }
        return result.toString();
    }
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))
97934
def random_string(length):
    
    # avoid things that could be mistaken ex: 'I' and '1'
    letters = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ"
    return "".join([random.choice(letters) for _ in range(length)])
622864
def random(self, length=None):
        
        if length is None:
            length = self._length

        random_num = int(binascii.b2a_hex(os.urandom(length)), 16)
        return int_to_string(random_num, self._alphabet, padding=length)[:length]
962872
function generateString(set, length) {
    var content = '';

    // Cannot generate a string from an empty set
    if (set.length <= 0) {
      return content;
    }

    for (var i = 0; i < length; i++) {
      content += String.fromCharCode(
        set[Math.floor(Math.random() * set.length)]
      );
    }

    return content;
  }
627991
def random_chars(number):
    """"""
    char_map = {
        k: v for k, v in chars.CHARS.iteritems()
        if not format_character(k).startswith('\\x')
    }

    char_num = sum(char_map.values())
    return (
        format_character(nth_char(char_map, random.randint(0, char_num - 1)))
        for _ in xrange(0, number)
    )
492973
def rand_str(charset, length=32):
    
    return "".join([random.choice(charset) for _ in range(length)])
949620
def random_string(**kwargs):
    
    n = kwargs.get('length', 10)
    pool = kwargs.get('pool') or string.digits + string.ascii_lowercase
    return ''.join(random.SystemRandom().choice(pool) for _ in range(n))
664084
function randomColour() {
  var num = Math.floor(Math.random() * Math.pow(2, 24));
  return '#' + ('00000' + num.toString(16)).substr(-6);
}
873775
def random_string(len)
      rand_max = RAND_CHARS.bytesize
      ret = ""
      len.times{ ret << RAND_CHARS[rand(rand_max)] }
      ret
    end
914826
public static function generateRandomString($numberOfChars, $includeCaps = true, $includeNumbers = true, $includeSymbols = false) {

        $possibleChars = range(97, 122);

        // If include caps, add in capital letters
        if ($includeCaps) $possibleChars = array_merge($possibleChars, range(65, 90));
        if ($includeNumbers) $possibleChars = array_merge($possibleChars, range(48, 57));
        if ($includeSymbols) $possibleChars = array_merge($possibleChars, array(33, 64, 35, 43, 61, 42, 63));


        $string = "";
        for ($i = 0; $i < $numberOfChars; $i++) {
            $string .= chr($possibleChars[rand(0, sizeof($possibleChars) - 1)]);
        }


        return $string;
    }
864119
def rand_str(min_char=MIN_CHR, max_char=MAX_CHR, min_len=MIN_STRLEN, 
             max_len=MAX_STRLEN, func=chr, **kwargs):
    '''
    '''
    l = randint(min_len, max_len)

    ret = ''
    for k in xrange(l):
        ret += func(randint(min_char, max_char))
    return ret
613952
def random_id_generator(self, size=6, chars=string.ascii_uppercase +
                            string.digits):
        '''  '''
        return ''.join(random.choice(chars) for x in range(size))
231981
def rand_alphastr(length, lower=True, upper=True):
    
    if lower is True and upper is True:
        return rand_str(length, allowed=string.ascii_letters)
    if lower is True and upper is False:
        return rand_str(length, allowed=string.ascii_lowercase)
    if lower is False and upper is True:
        return rand_str(length, allowed=string.ascii_uppercase)
    else:
        raise Exception