Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
mlnUsers: update lottery code
Browse files Browse the repository at this point in the history
  • Loading branch information
tnqzh123 committed Sep 21, 2023
1 parent 2ad9b46 commit 54de365
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions mlnUsers/lottery.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@
抽奖程序源码如下:

:::: details 点击查看抽奖程序源码
::: warning 注意
当前代码中的随机数生成器的种子仅为示例,实际抽奖时将使用上述的彩票开奖号码作为种子。
:::
``` python
import random
import pandas as pd
Expand Down Expand Up @@ -96,14 +93,14 @@ all_prizes = [ # 全员奖池
csv = pd.read_csv('participants.csv') # 读取参与名单
participants = csv.uid.tolist()

random.seed('16 24 26 28 31 01 06') # 09/20/2023 大乐透开奖号码,前 5 个为前区号码,后 2 个为后区号码
random.seed('01 12 21 22 31 02 09') # 09/20/2023 大乐透开奖号码,前 5 个为前区号码,后 2 个为后区号码
random.shuffle(early_prizes) # 打乱早鸟奖池顺序
random.shuffle(all_prizes) # 打乱全员奖池顺序

random.shuffle(participants) # 打乱参与名单顺序
earlybirds = list(filter(lambda x: x < 500000, participants)) # 筛选早鸟名单

random.seed('03 07 18 25 29 33 14') # 09/21/2023 双色球开奖号码,前 6 个为红球号码,最后一个为蓝球号码
random.seed('06 08 10 13 16 28 13') # 09/21/2023 双色球开奖号码,前 6 个为红球号码,最后一个为蓝球号码
early_winners = random.sample(earlybirds, len(early_prizes)) # 早鸟奖池抽奖
early_result = pd.DataFrame({'uid': early_winners, 'prize': early_prizes}) # 生成早鸟奖池抽奖结果
early_result.to_csv('early_winners.csv', index=False) # 导出早鸟奖池抽奖结果为 CSV 文件
Expand Down

0 comments on commit 54de365

Please sign in to comment.