Since: 8.2

final class Xoshiro256StarStar implements Engine (View source)

Implements the xoshiro256** algorithm.

Methods

__construct(string|int|null $seed = null)

Constructs a new xoshiro256** engine

string
generate()

Generate 64 bits of randomness

void
jump()

Efficiently move the engine ahead by 2^128 steps

void
jumpLong()

Efficiently move the engine ahead by 2^192 steps

array
__serialize()

Serializes the Xoshiro256StarStar object

void
__unserialize(array $data)

Deserializes the data parameter into a Xoshiro256StarStar object

array
__debugInfo()

Returns the internal state of the engine

Details

__construct(string|int|null $seed = null)

Constructs a new xoshiro256** engine

Parameters

string|int|null $seed

How the internal 256 bit (32 byte) state consisting of four unsigned 64 bit integers is seeded depends on the type used as the seed. Type Description null Fills the state with 32 random bytes generated using the CSPRNG. int Fills the state with four consecutive values generated with the SplitMix64 algorithm that was seeded with seed interpreted as an unsigned 64 bit integer. string Fills the state by interpreting a 32 byte string as four little-endian unsigned 64 bit integers.

Exceptions

ValueError

string generate()

Generate 64 bits of randomness

Return Value

string

A non-empty string containing random bytes. The Random\Randomizer works with unsigned 64 bit integers internally. If the returned string contains more than 64 bit (8 byte) of randomness the exceeding bytes will be ignored. Other applications may be able to process more than 64 bit at once.

void jump()

Efficiently move the engine ahead by 2^128 steps

Moves the algorithm’s state ahead by 2128 steps, as if Random\Engine\Xoshiro256StarStar::generate was called 2128 times.

Return Value

void

No value is returned.

void 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.

Return Value

void

No value is returned.

array __serialize()

Serializes the Xoshiro256StarStar object

Return Value

array

void __unserialize(array $data)

Deserializes the data parameter into a Xoshiro256StarStar object

Parameters

array $data

Return Value

void

No value is returned.

array __debugInfo()

Returns the internal state of the engine

Return Value

array