Howdy, Stranger!

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

Categories

arrays and random numbers

dpharmdpharm Member Posts: 22
a method/function that will sum the rowsin an array . if 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)
{
do
{
rowposition = getRandomNumber(values[rows][rowposition]);
--values[rows][rowposition];
}while ((rowsum[rows] != maximum));//end do while
}//end if
}//end for
sum();//call sum function
}//end decrement method
Sign In or Register to comment.