0
I have to do an exercise in Java that consists in creating a matrix [3][3] and each line would be a phase of the game. The user should guess which door the prize is in. For this I need to make a Random in each row assigning the value 1 to the premium port and 0 to the others, the question is how do I do this Random line by line?
Thank you for the reply mgibsonbr, I will try here.
– Marcio.Rezende
@Marciorezende I saw the code you posted and deleted, you must have solved it yourself, but if not, two tips: 1) Put the giveaway inside the loop, not outside (otherwise the door drawn will be the same every time); 2) You don’t need an internal loop, because integer arrays in Java are already initialized with everything zero - just do
porta[i][qual] = 1
.– mgibsonbr
mgibsonbr, it was worth the strength. I saw that I was doing nonsense, I have a teacher who does not teach, exercise or correct. I am learning more here with you than in class :). Thanks.
– Marcio.Rezende