【发布时间】:2021-06-23 19:05:47
【问题描述】:
所以我试图在显示锦标赛比赛的地方执行此代码。我想这样做,所以每次你运行程序时,它都会随机化团队的顺序,我试图做到这一点,这样就不会创建重复项。我有四个变量要使用。当我运行它时,似乎什么都没有发生,它没有崩溃,它只是表明它正在工作,但没有显示任何内容。
public void generateMatches() {
w = (int)(Math.random()*3);
x = (int)(Math.random()*3);
y = (int)(Math.random()*3);
z = (int)(Math.random()*3);
do {
w = (int)(Math.random()*3);
x = (int)(Math.random()*3);
y = (int)(Math.random()*3);
z = (int)(Math.random()*3);
} while (x == y || y == z || x == z || x == w || y == w || z == w);
}
【问题讨论】:
-
您在该代码中的何处显示任何内容?
-
JVM 会崩溃还是不会崩溃?
-
您的问题描述(“它没有崩溃”)与您的标题(“它只是崩溃”)相矛盾。它是哪一个? @Kayaman 也是对的。您需要编辑您的问题以澄清它,解决歧义和矛盾。