arrays and random numbers

a method/function which will sum the rows. if a row is greater than maximum number, decrement a member of the row until the sum drops to maximum
//this is the code i have

public void decrement(int maximum)
int rowposition = 0, colposition = 0;

for (int Sum_Rows = 0; Sum_Rows < rows; Sum_Rows++)
if (rowsum[rows] > maximum)
rowposition = getRandomNumber(values[rows][rowposition]);
}while ((rowsum[rows] != maximum));//end do while
}//end if
}//end for
}//end decrement method


  • [code]
    }while ((rowsum[rows] != maximum));//end

    Just one comment from me at this time. I would change the "!=" to ">" so that the check includes all values greater than maximum instead of just equal to.

    Take Care,
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion