diff --git a/lottery_random.py b/lottery_random.py index cbab06a..dd85d45 100644 --- a/lottery_random.py +++ b/lottery_random.py @@ -2,10 +2,10 @@ import numpy import datetime -def new_num(max_num, random_num): +def new_num(min_num, max_num, random_num): num = {} - d = [i for i in range(1, max_num + 1)] + d = [i for i in range(min_num, max_num + 1)] n = 100000 while n > 0: @@ -15,7 +15,7 @@ def new_num(max_num, random_num): if r in num.keys(): num[r] += 1 else: - num[r] = 0 + num[r] = 1 n -= 1 sorted_result = sorted(num.items(), key=lambda x: x[0]) @@ -52,4 +52,4 @@ if __name__ == "__main__": # print_time() # print_num('red', get_num(new_num(33, 6), new_num(33, 6), 6)) # print_num('blue', get_num(new_num(16, 1), new_num(16, 1), 1)) - print(new_num(33, 6)[0:6]) \ No newline at end of file + print(new_num(1, 11, 3)) diff --git a/real_index.py b/real_index.py index 45a6aad..905176b 100644 --- a/real_index.py +++ b/real_index.py @@ -10,7 +10,7 @@ db = { 'database': 'lottery' } -real_blue = ["01", "04", "09", "10", "20", "33"] +# real_blue = ["01", "04", "09", "10", "20", "33"] def get_real_data(): diff --git a/red_forecast.py b/red_forecast.py index 46ebeb2..56fdaa2 100644 --- a/red_forecast.py +++ b/red_forecast.py @@ -164,11 +164,15 @@ def get_random_index(): random_low = random.randint(1, 6 - random_high) random_middle = 6 - random_high - random_low print('分布区间(高概率区,中概率区,低概率区):', random_high, random_middle, random_low) - high_red_index_list = [n[0] - 1 for n in new_num(11, random_high)[0:random_high]] - middle_red_index_list = [n[0] - 1 + 10 for n in new_num(11, random_middle)[0:random_middle]] - low_red_index_list = [n[0] - 1 + 20 for n in new_num(11, random_low)[0:random_low]] + high_red_index_list = [(n[0]-1) for n in new_num(1, 11, random_high)[0:random_high]] + middle_red_index_list = [(n[0]-1) for n in new_num(12, 22, random_middle)[0:random_middle]] + low_red_index_list = [(n[0]-1) for n in new_num(23, 33, random_low)[0:random_low]] + print(high_red_index_list) + print(middle_red_index_list) + print(low_red_index_list) red_index_list = sorted(high_red_index_list + middle_red_index_list + low_red_index_list) - # print(red_index_list) + print(f"排序后结果") + print(red_index_list) return red_index_list