def randomString(length, chrs):
 n = len(chrs)
 return ''.join([chrs[randrange(n)] for _ in xrange(length)])

def randomString ( length , chrs ) : n = len ( chrs ) return '' . join ( [ chrs [ randrange ( n ) ] for _ in xrange ( length ) ] )
produce a string of length random bytes .