function RandomBytesGenerator::generate
@inheritDoc
Throws
RandomSourceException if random_bytes() throws an exception/error
Overrides RandomGeneratorInterface::generate
File
-
vendor/
ramsey/ uuid/ src/ Generator/ RandomBytesGenerator.php, line 33
Class
- RandomBytesGenerator
- RandomBytesGenerator generates strings of random binary data using the built-in `random_bytes()` PHP function
Namespace
Ramsey\Uuid\GeneratorCode
public function generate(int $length) : string {
try {
return random_bytes($length);
} catch (Throwable $exception) {
throw new RandomSourceException($exception->getMessage(), (int) $exception->getCode(), $exception);
}
}