$ranges = [[1, 17], [26, 100]];
$total = 0;
foreach ($ranges as $range)
$total += $range[1]-$range[0]+1;
$rand = rand(0, $total-1);
foreach ($ranges as $range) {
$rand += $range[0];
if ($rand > $range[1])
$rand -= $range[1]+1;
else
break;
}
echo $rand;