Use xrange iterator to generate characters for get_random_bytes