#_author:LTX
#date:2019/11/4
import random
#(1)
print(random.random())#0.5863887824309792 0----1之间的随机数
#(2)
print(random.choice([1,'qsc','234']))# qsc
#(3)
print(random.randint(1,8))#取1---8的整数 --> 1
#(4)
print(random.randrange(1,9)) # 随机选择数字 8
#(5)
print(random.sample([1,5,[1,2,3],'asd'],2)) #随机的选两个 ['asd', 5]
#(6) 返回一个打乱的序列
list=[1,3,6,'ghu',[3,5,7]]
random.shuffle(list)
print(list)
#(7)五位随机验证码
def info():
code=''
for i in range(5):
add_num=random.choice([str(random.randrange(10)),chr(random.randrange(65,91))])
code+=add_num
print(code)
info()
# Output:
# 5KZC8