Re: Use of php_mt_rand() rather than php_rand()
| From: | Yasuo Ohgaki | Date: | Wed, 16 Jul 2014 20:28:55 +0000 |
| Subject: | Re: Use of php_mt_rand() rather than php_rand() | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75601@lists.php.net to get a copy of this message | ||
Hi,
On Thu, Jul 17, 2014 at 3:00 AM, Andrea Faulds <ajf@ajf.me> wrote:
> > Do you propose making rand() a synonym for mt_rand()? If so, wouldn't it
> make sense for srand() to become a synonym for mt_srand()?
>
> Whether that’s what Yasuo proposes or not, I’d like to see this. It’s
> rather silly that rand() isn’t the proper one, and that mt_rand() is. We
> could always rename rand() to legacy_rand() or something.
I wasn't intended to use MT rand for rand() as the bug report suggests (
https://bugs.php.net/bug.php?id=66718)
Having mt_shuffle(), mt_whatever() would not be a good idea. IMO.
Making MT rand the default everywhere is valid choice. Almost all codes
that use rand()/mt_rand() expect
true randomness even if they are not.
I'll add rand() rename option for upcoming RFC.
rand() to lagacy_rand()/rand_legacy()/rand_system(), perhaps? The name can
be any.
Suggestions are appreciated.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net