19 lines
435 B
PHP
19 lines
435 B
PHP
<?php
|
|
|
|
final class UUIDGenerator
|
|
{
|
|
|
|
public static function generate(): string
|
|
{
|
|
return "urn:uuid:" . sprintf(
|
|
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
|
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
|
|
mt_rand(0, 0xffff),
|
|
mt_rand(0, 0xffff) | 0x4000,
|
|
mt_rand(0, 0x3fff) | 0x8000,
|
|
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
|
|
);
|
|
}
|
|
|
|
}
|