random

Learn how to generate a random UUID.

This method generates a new random UUID.

Signature

This method has the following signature:

public static function random(): self

This method returns a new instance with a randomly generated version 4 value.

Example

Here is a basic example of how to use this method:

<?phpuse Croct\Plug\Uuid;
$uuid = Uuid::random();