So this is what I have so far.
public static int[][] generateRandomPositions(int number, int width, int height){
for(int j=0; j <number; j++){
int[][] pos = new int[][]{
{Utility.randomInt(width),Utility.randomInt(height)}
};
}
return [][]pos;
}
Basically the method gets a number which is the number of rows there should be and the width and height is the two numbers that will be in the two columns. Those of which are randomly generated between the number given (ex Utility.randomInt(5) would be between 0 and 5). The problem I am having is figuring out how to create the number of rows based off the number that is inputted. What I have I don't believe works. This is an example of what the out come should be if these numbers were inputted.
generateRandomPositions(4, 5, 30)
int[][] posB = new int[][] {
{ 3,21 },
{ 4,15 },
{ 1,17 }
{ 3,9 }
};
There are 4 rows because 4 was inputted as the number. The other numbers were randomly generated. So I just need help figuring out how to create the number of rows based off the numbers variable inputted. I am fairly new to programming so and suggestions and help would be greatly appreciated.