import random
def Random_Unicode_String(l):
s = ""
for i in range(l):
s += chr(random.randint(0, 65535))
return s
def Random_Chinese_String(l):
s = ""
for i in range(l):
s += chr(random.randint(0x4E00, 0x9FA5))
return s
def Hash(s):
h = 0
for i in range(len(s)):
h = h * 47 + ord(s[i])
return h
def main():
while True:
print("欢迎来到取名神器!")
c = input("你需要用现有名字作为种子吗?(y/n)")
if c == 'y':
name = input("输入你现有的名字:")
random.seed(Hash(name))
l = int(input("输入生成长度:"))
m = input("是否要正常中文名?(y/n)")
if m == 'y':
print(Random_Chinese_String(l))
else:
print(Random_Unicode_String(l))
main()