Random¶
Random generators generates numbers or strings.
random_bytes(), random_int() and openssl_random_pseudo_bytes() produce pseudo-random data, suitable for cryptography.
Traditional native functions, such as rand() and mt_rand() are not recommended for cryptography.
<?php
$bytes = random_bytes(5);
var_dump(bin2hex($bytes));
?>