私はマッチメイキングロジックで作業するように求められました。私は自分のコードに次のパーセンテージを与える必要があります(65%、30%、4% 、1%)が、私はちょうどそれが最適な実装だかどうかを確認したい、またはあなたたちは、他のアイデアを持っている場合:65%、30%、4%、1%
random_session = await create_random_session(
connection, 'group', session_size=4, random_value = "case1", "case2", "case3", "case4",
)
for for random_value in random_session:
if random.randint(0, 100) < 65:
random_value = "case1"
continue
else:
random.randint(0, 100) < 30:
random_value = "case2"
continue
else:
random.randint(0, 100) < 4:
random_value = "case3"
continue
else:
random.randint(0, 100) < 1:
random_value = "case4"
continue
のために存在するの答えはYesですが、私は私ができることを願っていますそれをより速くする。 –
codereview.stackexchange.comに属しているので、この質問を議論の対象外とすることにしました。 – blue112