note 127573 added to function.random-int
| From: | jawira at main dot php dot net | Date: | Mon, 05 Sep 2022 09:10:43 +0000 |
| Subject: | note 127573 added to function.random-int | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219516@lists.php.net to get a copy of this message | ||
Unlike
rand() function, random_int() actually require to be provided with
two parameters.
Use mt_getrandmax() to get the maximum value for $max parameter.
<?php
random_int(0, mt_getrandmax());
?>
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.173 (proxied: 195.244.160.92)
----
Manual Page -- https://php.net/manual/en/function.random-int.php
Edit -- https://main.php.net/note/edit/127573
Del: integrated -- https://main.php.net/note/delete/127573/integrated
Del: useless -- https://main.php.net/note/delete/127573/useless
Del: bad code -- https://main.php.net/note/delete/127573/bad+code
Del: spam -- https://main.php.net/note/delete/127573/spam
Del: non-english -- https://main.php.net/note/delete/127573/non-english
Del: in docs -- https://main.php.net/note/delete/127573/in+docs
Del: other reasons-- https://main.php.net/note/delete/127573
Reject -- https://main.php.net/note/reject/127573
Search -- https://main.php.net/manage/user-notes.php