function UnixTimeGenerator::randomize
2 calls to UnixTimeGenerator::randomize()
- UnixTimeGenerator::generate in vendor/
ramsey/ uuid/ src/ Generator/ UnixTimeGenerator.php - @inheritDoc
- UnixTimeGenerator::increment in vendor/
ramsey/ uuid/ src/ Generator/ UnixTimeGenerator.php - Special thanks to Nicolas Grekas for sharing the following information:
File
-
vendor/
ramsey/ uuid/ src/ Generator/ UnixTimeGenerator.php, line 92
Class
- UnixTimeGenerator
- UnixTimeGenerator generates bytes that combine a 48-bit timestamp in milliseconds since the Unix Epoch with 80 random bits
Namespace
Ramsey\Uuid\GeneratorCode
private function randomize(string $time) : void {
if (self::$seed === null) {
$seed = $this->randomGenerator
->generate(16);
self::$seed = $seed;
}
else {
$seed = $this->randomGenerator
->generate(10);
}
/** @var int[] $rand */
$rand = unpack('n*', $seed);
$rand[1] &= 0x3ff;
self::$rand = $rand;
self::$time = $time;
}