优化红球的随机算法

main
roger_home_pc 2 years ago
parent f7a51e0544
commit cf275d0175
  1. 8
      red_forecast.py

@ -154,10 +154,10 @@ def update_red_forecast_db():
def get_random_index():
# 产生随机数
random_small, random_middle, random_big = 0, 0, 0
while random_middle <= 0:
random_big = random.randint(1, 3)
random_small = random.randint(1, 2)
random_small, random_middle, random_big = -1, -1, -1
while random_small < 0 or random_middle < 0 or random_big < 0:
random_small = random.randint(0, 2)
random_big = random.randint(1, 6 - random_small)
random_middle = 6 - random_small - random_big
# print(random_small, random_middle, random_big)
small_red_index_list = [n[0] - 1 for n in new_num(11, random_small)[0:random_small]]

Loading…
Cancel
Save