在我向它引入以下代码之前,该程序运行良好: 为我的随机数生成器捕获重复项基本上是很长的路要走,因为我还没有在 Java 上进阶。我听说过 arraylists 和 collections.shuffle 但它们对我来说太先进了。无论如何,当我单击激活此代码的按钮时,为什么我的程序会冻结?
do {
if (BArray[1] == BArray[0]){
BArray[1] = 1 + bNumber.nextInt(15);
}
if (BArray[2] == BArray[1] || BArray[2] == BArray[0]) {
BArray[2] = 1 + bNumber.nextInt(15);
}
if (BArray[3] == BArray[2] || BArray[3] == BArray[1] || BArray[3] == BArray[0]){
BArray[3] = 1 + bNumber.nextInt(15);
}
if (BArray[4] == BArray[3] || BArray[4] == BArray[2] || BArray[4] == BArray[1] || BArray [4] == BArray[0])
BArray[4] = 1 + bNumber.nextInt(15);
} while (BArray[4] != BArray[3] || BArray[4] != BArray[2] ||
BArray[4] != BArray[1] || BArray[4] != BArray[0] ||
BArray[3] != BArray[2] || BArray[3] != BArray[1] ||
BArray[3] != BArray[0] || BArray[2] != BArray[1] ||
BArray[2] != BArray[0] || BArray[1] != BArray[0]);