python双色球根据概率自由组合红球

泽江东旭侯 2024-07-25 14:27:25

在双色球的组号中,我们可以根据红球的出号频率来组号,比如选择前三十期的数据中前25的号码,或者前18的号码来组合新的红球组合,在统计号前期红球号码以后,可根据红球的冷热程度,红球的人气指数来适当取舍。

江东旭侯双色球组号代码

python双色球根据概率自由组合红球代码如下:

import random# 定义号码列表输入大乐透双色球排名前25的数据numbers = [2, 6, 22, 32, 9, 14, 17, 8, 1, 28, 18, 12, 7, 21, 29, 26, 10, 20, 31, 5, 23, 25, 3, 19, 24]# 分组可修改参数top10 = numbers[:10]mid10 = numbers[10:21]last5 = numbers[21:]# 生成随机组合可修改选择的个数321def generate_combinations(top, mid, last, num_groups): combinations = [] while len(combinations) < num_groups: top_choice = random.sample(top, 3) mid_choice = random.sample(mid, 2) last_choice = random.sample(last, 1) group = top_choice + mid_choice + last_choice random.shuffle(group) # 打乱组合顺序 if group not in combinations: # 确保号码唯一 combinations.append(group) return combinations# 获取用户输入num_groups = int(input("请输入你想要生成的红球号码组合数: "))# 生成双色球红球号码random_combinations = generate_combinations(top10, mid10, last5, num_groups)# 打印结果for i, group in enumerate(random_combinations, 1): print(f"红球号码组合 {i}: {group}")# 保存到文件with open("lottery_numbers.txt", "w") as file: for group in random_combinations: file.write(f"{group}\n")print("红球号码已保存到 lottery_numbers.txt")

2, 6, 22, 32, 9, 14, 17, 8, 1, 28, 18, 12, 7, 21, 29, 26, 10, 20, 31, 5, 23, 25, 3, 19, 24

江东旭侯双色球选号组号代码

代码模拟运行结果1

正在运行程序...

请输入你想要生成的双色球红球组合数: 20

双色球红球组合 1: [25, 1, 14, 2, 21, 23]

双色球红球组合 2: [19, 9, 10, 18, 14, 1]

双色球红球组合 3: [9, 32, 22, 24, 7, 23]

双色球红球组合 4: [28, 22, 20, 29, 9, 19]

双色球红球组合 5: [18, 6, 8, 25, 9, 31]

双色球红球组合 6: [8, 31, 20, 1, 2, 25]

双色球红球组合 7: [6, 28, 29, 17, 21, 19]

双色球红球组合 8: [1, 14, 17, 18, 24, 26]

双色球红球组合 9: [2, 9, 6, 29, 3, 5]

双色球红球组合 10: [17, 29, 19, 10, 8, 22]

双色球红球组合 11: [17, 21, 28, 5, 6, 19]

双色球红球组合 12: [6, 31, 22, 29, 14, 24]

双色球红球组合 13: [32, 18, 19, 23, 2, 6]

双色球红球组合 14: [6, 22, 12, 24, 21, 2]

双色球红球组合 15: [3, 18, 1, 32, 31, 8]

双色球红球组合 16: [24, 5, 8, 9, 21, 1]

双色球红球组合 17: [9, 29, 18, 1, 32, 3]

双色球红球组合 18: [29, 2, 5, 19, 14, 22]

双色球红球组合 19: [10, 14, 25, 1, 32, 12]

双色球红球组合 20: [26, 24, 2, 32, 12, 1]

感谢阅读感谢支持

代码模拟运行结果2

正在运行程序...

请输入你想要生成的双色球红球组合数: 20

双色球红球组合 1: [2, 7, 18, 17, 28, 3]

双色球红球组合 2: [8, 17, 25, 28, 7, 31]

双色球红球组合 3: [6, 31, 17, 25, 26, 8]

双色球红球组合 4: [1, 29, 21, 3, 28, 17]

双色球红球组合 5: [25, 18, 28, 8, 12, 22]

双色球红球组合 6: [9, 2, 3, 26, 28, 5]

双色球红球组合 7: [20, 9, 19, 5, 32, 8]

双色球红球组合 8: [24, 28, 2, 7, 22, 18]

双色球红球组合 9: [19, 6, 1, 14, 10, 5]

双色球红球组合 10: [2, 21, 32, 1, 23, 3]

双色球红球组合 11: [2, 28, 29, 26, 9, 3]

双色球红球组合 12: [22, 20, 19, 9, 1, 21]

双色球红球组合 13: [6, 17, 3, 18, 10, 9]

双色球红球组合 14: [25, 21, 22, 26, 2, 8]

双色球红球组合 15: [25, 1, 8, 7, 20, 28]

双色球红球组合 16: [20, 1, 14, 3, 21, 22]

双色球红球组合 17: [29, 19, 2, 5, 8, 9]

双色球红球组合 18: [10, 1, 26, 19, 14, 22]

双色球红球组合 19: [19, 22, 23, 7, 2, 9]

双色球红球组合 20: [31, 1, 8, 28, 7, 19]

考虑到双色球红球下移号码比较少。可适当去掉上期号码来组号。

上述25码为示例选择,可选择热门18码左右的数据,再去掉上期号码来组号,

如果是18码组选数可修改参数

# 分组可修改参数

top10 = numbers[:6]

mid10 = numbers[6:12]

last5 = numbers[12:]

代码模拟运行如下:

请输入你想要生成的双色球红球组合数: 10

双色球红球组合 1: [2, 25, 31, 26, 12, 1]

双色球红球组合 2: [12, 5, 20, 1, 7, 15]

双色球红球组合 3: [19, 20, 8, 12, 7, 28]

双色球红球组合 4: [7, 24, 28, 26, 15, 2]

双色球红球组合 5: [1, 23, 21, 8, 28, 26]

双色球红球组合 6: [28, 8, 23, 31, 2, 7]

双色球红球组合 7: [5, 31, 28, 7, 8, 1]

双色球红球组合 8: [5, 26, 1, 21, 2, 12]

双色球红球组合 9: [4, 28, 2, 7, 8, 20]

双色球红球组合 10: [5, 7, 1, 20, 12, 15]

祝您好运

另外选择历史数据时,选择以前三十期,或者50期数据比较合适。

36 阅读:3786
评论列表