random.sample()函数
原文摘自:https://blog.csdn.net/weixin_42983044/article/details/82084525
另附上自己代码
def CreatRandom(num):
import random
source = "01234567890123456789012345678901234567890123456789"
string = ''
Trandom = string.join(random.sample(source, num))
return Trandom
print(CreatRandom(2))
会输出字符个数