seed($seed); } public function seed(int $seed): void { $s = fmod(abs((float)$seed), 2147483647.0); $this->state = $s < 1 ? 1.0 : $s; } /** 0 <= x < 1 */ public function next(): float { $this->state = fmod($this->state * 16807.0, 2147483647.0); return ($this->state - 1) / 2147483646.0; } public function between(float $min, float $max): float { return $min + ($max - $min) * $this->next(); } }