国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

PHP CSPRNG

CSPRNG(????? ??? ?? ?? ???, ?? ?? ???).

PHP 7? ?? CSPRNG ??? ???? ???? ??? ??? ???? ??? ????? ?????.

  • random_bytes() - ???? ??? ?? ?? ??????.

  • random_int() - ???? ??? ?? ?? ?????.


random_bytes()

Syntax format

string random_bytes ( int $length )

Parameters

  • length - ?? ????? ??? ??? ????.

?? ?

  • ???? ???? ??? ??? ??? ?? ???? int ?? ?? ?? ??? ?????.

Instance

<?php
$bytes = random_bytes(5);
print(bin2hex($bytes));
?>

? ???? ??? ?? ??? ??? ????.

6f36d48a29

random_int()

Syntax format

int random_int ( int $min , int $max )

Parameters

  • min - ??? ??? ?? ? ?? ???. PHP_INT_MIN ?????.

  • max - ??? ???? PHP_INT_MAX ???? ???.

?? ?

  • ??? ?? ?? ?? ??? ?????.

Instance

<?php
print(random_int(100, 999));
print(PHP_EOL);
print(random_int(-1000, 0));
?>

? ???? ??? ?? ??? ??? ????.

723
-64
???? ??
||
<?php $bytes = random_bytes(5); print(bin2hex($bytes)); ?>