Surely there is a way you can achieve your goal without doing the extra work of setting the value of most of your elements twice.
Type: Posts; User: jps
Surely there is a way you can achieve your goal without doing the extra work of setting the value of most of your elements twice.
Yes that is why you use random.
First you declare your variable and initialize it with the line of code:
boolean[][] matrix = new boolean[numRows][numCols];
Then there is no reason to set them all...
I don't understand what you mean here. It is my fault for so many posts. When you have a question about a post, you can quote it or refer to it to make it easier to follow what you mean in your reply.
I am not sure allowing the user control over your random generator's seed is exactly what you want, maybe it is. Ask yourself, is this something the user of your code needs to be able to do?
I...
On a side note, in your readNums method you have a few lines of code I'd like to discuss:
boolean[][] matrix = new boolean[numRows][numCols];
createMatrix(matrix);
for(int row = 1;...
Well you determined you wanted to set the matrix all to false. So when you call the method you would just do it that way. Just assume for a moment that your createMatrix method was replace with the...
The idea of javadoc is to educate the user of your code about your code. To get a good understanding, do a search for javadoc and just spend twenty minutes looking over existing documents. The html...
Your method:
/**Creates a matrix with lengths entered and sets all values false*/
private static void createMatrix(boolean[][] matrix)
{
for(int r = 0; r < matrix.length; r++)
{...
Your javadoc comments should be complete sentences describing the purpose and function of the block of code they refer to. You can use @return and @param to describe specific parts of methods. For...
Much rather see the code on the forum rather than in an attachment.
Just type
Copy paste your code from your class file here.
(ctrl+a to select all of your file followed by ctrl+c to copy to...
When pseudo-random numbers are generated a seed is used to determine a starting point. So say you make a random number generator and use seed 0. You start pulling nextBoolean one by one and say for...