如何以这样的方式创建随机数,即数字的总和在php中应该只是整数还是零?

I am creating one algorithm for kids that will create random numbers and showing 5 numbers in each row upto 6 rows.for whole numbers it is good.But when i am taking random numbers between a negative and a positive number then there is possibility of negative result.So what should i write so that the result will be only positive number or zero irrespective of taking negative numbers? Below is my code,

   $Final_Array = array();
   $Final_Ansarray = array();
   for ($i = 1; $i < 31; $i++) {
    $Random_Number = mt_rand(-4,8);
    $RandVal = $Random_Number . "";
    array_push($Final_Array, $RandVal);
   }
  $Chunked_Array = array_chunk($Final_Array, 5);
  foreach ($Chunked_Array as $key => $value) {
    foreach ($value as $key2 => $value2) {
        echo $value2 . "
";
    }
    echo "|";
   }
    foreach ($Chunked_Array as $k => $subArray) {
    $Answers = array_sum($subArray);
    echo $Answers . "|";
    array_push($Final_Ansarray, $Answers);
}

Try this

$cols = 5;
$rows = 6;

$array = array();

for ($j = 0; $j < $rows; $j++)
    {
    do
        {
        for ($i = 0; $i < $cols; $i++)
            $array[$i] = mt_rand(-4, 8);
        }
    while (array_sum($array) < 0); // pass only non negative sums

    echo'sum', json_encode($array), ' = ', array_sum($array), PHP_EOL;
    }

Example output

sum[1,-1,2,8,-2] = 8
sum[1,5,5,5,-4] = 12
sum[2,7,-1,6,0] = 14
sum[8,0,-2,-1,0] = 5
sum[7,-2,8,4,2] = 19
sum[7,-4,-4,0,1] = 0