def get_random_load_nonentry():
'''
Return a random item that probably isn't in match_func_result['load'].
'''
match_type = sys.argv[1]
if match_type == 'ipasn':
# Yes, we could do IPv6 here. But the type of the list doesn't matter:
# a random IPv4 might not be in an IPv4 list, and it won't be in an
# IPv6 list
random_32_bit = random.randint(0, 2**32 - 1)
ip = ipaddress.ip_address(random_32_bit)
return ip
else:
char_list = list(get_random_load_entry())
random.shuffle(char_list)
return "".join(char_list)
# try to make sure that other processes don't warp the results too much
评论列表
文章目录