<?php
function split_number($num, $count) {
$result = [];
for ($i = 1; $i<$count; $i++) {
// random number between 1 and half of given number
$result[$i] = rand(1, $num / 2);
$num -= $result[$i];
}
$result[0] = $num;
return $result;
}
$chunks = split_number(500, 5);