Req #66728 [Opn->Csd]: gmp_random is obsolete, switch to gmp_urandomm
| From: | nikic@php.net | Date: | Sat, 26 Mar 2016 11:23:27 +0000 |
| Subject: | Req #66728 [Opn->Csd]: gmp_random is obsolete, switch to gmp_urandomm | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-200106@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66728&edit=1
ID: 66728
Updated by: nikic@php.net
Reported by: asphp at dsgml dot com
Summary: gmp_random is obsolete, switch to gmp_urandomm
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: GNU MP related
PHP Version: Irrelevant
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Closing per previous comment.
Previous Comments:
------------------------------------------------------------------------
[2015-09-24 20:51:49] rainer dot jung at kippdata dot de
IMHO this issue can be closed: starting with PHP 5.6 there is gmp_random_range() which uses
mpz_urandomm() and the old gmp_random() uses mpz_urandomb(). Both should be fine.
------------------------------------------------------------------------
[2014-02-17 20:52:46] asphp at dsgml dot com
Description:
------------
According to the docs mpz_random (i.e. gmp_random) is obsolete. It's also pretty useless since
it returns digits in an undefined range.
Instead switch to mpz_urandomm which lets you specify the max directly.
PHP could either expose it as is and let people subtract to get the min, or PHP could make it easier
and let people specify a min and max.
PHP could require that people manually initialize the random state, or just go ahead and do it for
them with gmp_randinit_mt.
Also once this is a done a PHP warning should be emitted for use of gmp_random.
See: https://gmplib.org/manual/Integer-Random-Numbers.html
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66728&edit=1