PHP 8.2
jump();
$fibers[] = new Fiber(function () use ($fiberRng, $i): void {
$randomizer = new Randomizer($fiberRng);
echo "{$i}: " . $randomizer->getInt(0, 100), PHP_EOL;
});
}
// The randomizer will use a CSPRNG by default.
$randomizer = new Randomizer();
// Even though the fibers execute in a random order, they will print the same value
// each time, because each has its own unique instance of the RNG.
$fibers = $randomizer->shuffleArray($fibers);
foreach ($fibers as $fiber) {
$fiber->start();
}
PHP
); ?>