Skip to content

Random

Rasuvaeff\PropertyTesting\Random

ClassSource

Seedable, deterministic pseudo-random number generator.

Two instances created with the same seed produce identical sequences, which is what makes counterexamples reproducible. Backed by an object-scoped Mersenne Twister (MT19937) engine via ext-random's Randomizer, so it is independent of PHP's global mt_rand state — important inside a test runner where other code may draw random numbers between runs.

Methods

int()

php
int(int $min, int $max): int

Uniform integer in the inclusive range [$min, $max].

float()

php
float(): float

Uniform float in the half-open range [0.0, 1.0).

bytes()

php
bytes(int $length): string

Random byte string of the given length (bytes in 0..255).