A test using shuffle() that failed roughly once a fortnight, and a global seed that could not be set without affecting everything else.
use RandomEngineXoshiro256StarStar;
use RandomRandomizer;
$r = new Randomizer(new Xoshiro256StarStar(seed: 1234));
$r->shuffleArray($rows);
$r->getInt(1, 100);
// which is injectable, so the test uses a fixed seed and
// production uses the default secure engine:
public function __construct(private Randomizer $random) {}
The Randomizer arrived in 8.2 and 8.3 added methods to it; the reason to care is that randomness becomes a dependency rather than a global. A test that seeds the engine is deterministic without srand affecting anything else in the process, and the production path keeps a cryptographically secure engine because that is the default. The flaky test had been marked skipped since 2021.