I was trying to make a minesweeper program for homework, but I got a problem with making and positioning mines that hasn't solved for 3 hours. My code is
for(int i = 0; i < bomb; i++)
{
int x = randomGenerator.nextInt(m);
int y = randomGenerator.nextInt(n);
mines[x][y] = Integer.parseInt("*");
i++;
if(i == bomb)
break;
}
Can anyone knows what is wrong with it?