python随机数模拟
`#随机数
import random
red = range(1,36,1)
red_target_list=[]
i=1
while i< 6:
red_ran_index=random.randint(0,34) #0-34
red_target_list_value=red[red_ran_index]
# print(red_target_list_value)
if red_target_list_value not in red_target_list:
red_target_list.append(red_target_list_value)
else:
i-=1
i+=1
print(red_target_list)
blue = range(1,13,1)
blue_target_list=[]
j=1
while j < 3:
blue_ran_index=random.randint(0,11)
blue_target_list_value=red[blue_ran_index]
if blue_target_list_value not in blue_target_list:
blue_target_list.append(blue_target_list_value)
else:
j-=1
j+=1
print(blue_target_list)
print(red_target_list,blue_target_list)`````````
本文来自博客园,作者:diablo-427,转载请注明原文链接:https://www.cnblogs.com/diablo-427/p/16936061.html