(PHP 8 >= 8.2.0)
Random\Engine\Xoshiro256StarStar::jumpLong — Efficiently move the engine ahead by 2^192 steps
Moves the algorithm’s state ahead by 2192 steps, as if Random\Engine\Xoshiro256StarStar::generate() was called 2192 times.
The purpose of a long jump is to facilitate the creation of a new Random\Engine\Xoshiro256StarStar engine from an existing seeded Random\Engine\Xoshiro256StarStar engine. The seeded engine acts as a blueprint, which can be cloned and repeatedly jumped to create 264 non-overlapping sequences with 2192 values each.
Long jumping may be combined with Random\Engine\Xoshiro256StarStar::jump()ing to further split each of the 264 sequences generated by long jumping, into 264 sequences of 2128 values each.
У цієї функції немає параметрів.
Не повертає значень.
Приклад #1 Random\Engine\Xoshiro256StarStar::jumpLong() example
<?php
$blueprintRng = new \Random\Engine\Xoshiro256StarStar(0);
// Each parent engine will have its own chunk of 2**192 values.
$parent1 = clone $blueprintRng;
$blueprintRng->jumpLong();
$parent2 = clone $blueprintRng;
$blueprintRng->jumpLong();
// Each of the child engines will have its own chunk of 2**128 values
// taken from their parent engine’s chunk of 2**192 values.
$child1a = clone $parent1;
$parent1->jump();
$child1b = clone $parent1;
$parent1->jump();
$child2a = clone $parent2;
$parent2->jump();
$child2b = clone $parent2;
$parent2->jump();
echo "Child 1A: ", bin2hex($child1a->generate()), "\n";
echo "Child 1B: ", bin2hex($child1b->generate()), "\n";
echo "Child 2A: ", bin2hex($child2a->generate()), "\n";
echo "Child 2B: ", bin2hex($child2b->generate()), "\n";
?>
Поданий вище приклад виведе:
Child 1A: b4f275cb365fec99 Child 1B: 2cd646c8ed156237 Child 2A: eb3729a722a504e7 Child 2B: d4208dc85bdd6dc3