import random
import string
print(random.randint(1,100)) #随机从1-100取值,包含100
print(random.randrange(1,100)) #随机从1-100取值,不包含100
print(random.random()) # 随机浮点数
print(random.choice('abc123!@#')) ## 返回一个给定数据集合中的随机字符
print(random.sample('abc123!@#',3)) ## 返回多个特定数量的字符
##生成随机字符串
b1 = ''.join(random.sample(string.ascii_lowercase + string.digits , 10))
print (b1)
## 随机验证码
b = string.ascii_lowercase + string.digits
print('随机验证码--->:',''.join(random.sample(b,5)))
# 洗牌
b_new = list(range(0,100))
print (b_new)
b3 = random.shuffle(b_new)
print ('b_new--->:',b_new)