修改小学题目出题逻辑,保证至少两个操作数

pull/4/head
John Doe 7 months ago
parent 3db49a45fb
commit 88ae2ed5bb

@ -10,7 +10,8 @@ public final class PrimaryQuestionGenerator implements QuestionGenerator {
@Override
public String generateQuestion(Random random) {
int operandCount = random.nextInt(5) + 1;
// 至少生成两个操作数,避免题目退化成单个数字
int operandCount = random.nextInt(4) + 2;
StringBuilder builder = new StringBuilder();
for (int index = 0; index < operandCount; index++) {
if (index > 0) {

Loading…
Cancel
Save