Issue creating better random algorithm - daily spread
问题 i need a algoritm that spreads some numbers across a day in percentages, following min / max percentage for that time rule, this is what i have atm: public function getSpread() { $rules = [ '00-07' => ['min' => 5, 'max' => 10], '08-12' => ['min' => 20, 'max' => 30], '13-16' => ['min' => 20, 'max' => 30], '17-22' => ['min' => 25, 'max' => 40], '23-24' => ['min' => 10, 'max' => 15], ]; $spread = []; foreach ($rules as $time => $rule) { $value = rand($rule['min'], $rule['max']); while ($this-