From a8386cc69c5a7b6494a8d56437f3cd63004757c9 Mon Sep 17 00:00:00 2001 From: zhangyuheng Date: Tue, 22 Oct 2024 17:32:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=9A=BE=E9=A2=98=E6=AF=94?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Generator.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Generator.py b/Generator.py index c51685d..bb0269c 100644 --- a/Generator.py +++ b/Generator.py @@ -56,9 +56,8 @@ def generate_quests(type_str): # 有权中的按权重排序 list_quest_weighted.sort(key=lambda x: weights[x.code], reverse=True) list_quest = list_quest_unweighted + list_quest_weighted - # 根据权重随机选取题目 80% 的题目来自权重前 40% 的题目 20% 的题目来自权重后 60% 的题目 num = Config.quest_config[type_str]['num'] # 要生成的题目数量 - top = int(num * 0.8) + top = int(num * 0.4) quests = random.sample(list_quest[:top], top) + random.sample(list_quest[top:], num - top) # 对 quests 中的题目再次随机排序 random.shuffle(quests)