public void repopulation() {
int[][] ngrid = new int[grid.length][grid[0].length];
for(int i = 0; i < grid.length; i++) {
for(int j = 0; j < grid[0].length; j++) {
int random = (int) (Math.random() * MAX) + 1;
while (random % 10 != 0 || random % 100 == 0) {
random = (int) (Math.random() * MAX) + 1;
}
ngrid[i][j] = random;
}
}
grid = ngrid;
}
b)
public int countIncreasingCols() {
int c = 0;
for (int i = 0; i < grid[0].length; i++) {
boolean alr = true;
for (int j = 1; j < grid.length; j++) {
if (grid[j][i] < grid[j - 1][i]) {
alr = false;
}
}
if (alr) {
alr = false;
}
}
return c;
}
Comments
You are seeing this because your Disqus shortname is not properly set. To configure Disqus, you should edit your
_config.yml
to include either adisqus.shortname
variable.If you do not wish to use Disqus, override the
comments.html
partial for this theme.