Код: Выделить всё
static public int[][] createTransitionArray(int row, int col)
{
int[][] arr2d = new int[row][col];
int zero = 0;
for (int i = row; i == 0; i--)
{
for (int j = col; j == 0; j--)
{
int randomInt = (90 + (int)(Math.random() * ((100 - 90) + 1)));
if (j % 2 == 0)
{
arr2d[i][j] = zero;
}
else if (j % 2 != 0)
{
arr2d[i][j] = randomInt;
}
}
}
System.out.println(arr2d[2][3]);
System.out.println(arr2d[4][5]);
for (int k = 0; k < row; k++)
{
for (int l = 0; l
текущий вывод: < /p>
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
< /code>
Ожидаемый вывод (ненулевые числа случайны между 90 и 100) (игнорировать строки): < /p>
|0|99|0|94|0|100|0|93|0|99
|0|100|0|93|0|96|0|99|0|96
|0|93|0|94|0|91|0|93|0|97
---------------------------
|0|99|0|93|0|94|0|97|0|100
---------------------------
|0|96|0|100|0|91|0|97|0|94
---------------------------
|0|100|0|94|0|99|0|93|0|99
---------------------------
|0|93|0|100|0|97|0|95|0|95
---------------------------
|0|92|0|93|0|91|0|100|0|100
---------------------------
|0|95|0|95|0|96|0|98|0|95
---------------------------
|0|99|0|100|0|97|0|98|0|93
---------------------------
Подробнее здесь: https://stackoverflow.com/questions/796 ... -is-random