CascadiaPHP 2024


(PHP 8 >= 8.2.0)

Random\Engine\Xoshiro256StarStar::jumpLongEfficiently move the engine ahead by 2^192 steps


public Random\Engine\Xoshiro256StarStar::jumpLong(): void

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.

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

Hiçbir değer dönmez.


Örnek 1 Random\Engine\Xoshiro256StarStar::jumpLong() example

= new \Random\Engine\Xoshiro256StarStar(0);

// Each parent engine will have its own chunk of 2**192 values.
$parent1 = clone $blueprintRng;

$parent2 = clone $blueprintRng;

// 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;
$child1b = clone $parent1;

$child2a = clone $parent2;
$child2b = clone $parent2;

"Child 1A: ", bin2hex($child1a->generate()), "\n";
"Child 1B: ", bin2hex($child1b->generate()), "\n";
"Child 2A: ", bin2hex($child2a->generate()), "\n";
"Child 2B: ", bin2hex($child2b->generate()), "\n";

Yukarıdaki örneğin çıktısı:

Child 1A: b4f275cb365fec99
Child 1B: 2cd646c8ed156237
Child 2A: eb3729a722a504e7
Child 2B: d4208dc85bdd6dc3

Ayrıca Bakınız

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top