php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #72830 mt_srand documentation
Submitted: 2016-08-14 02:10 UTC Modified: 2016-08-15 10:40 UTC
From: montdm at montdm dot shost dot ca Assigned: cmb (profile)
Status: Closed Package: Math related
PHP Version: Irrelevant OS: Windows
Private report: No CVE-ID: None
 [2016-08-14 02:10 UTC] montdm at montdm dot shost dot ca
Description:
------------
Hi,

On your website for the mt_srand (in english and in french), you have writen in the "description" section :
void mt_srand ([ int $seed ] )

= I understand that the 'seed' has to be an int value

In the "parameters" section :
seed : an optional seed value (english version)
seed : une valeur d'initialisation aléatoire (french version)

= no explanation about what is the "value" or "valeur"

And in the "examples" section "Example #1 mt_srand() example" :

the make_seed function returns a float !

What should be the "value" ? A (int) or a (float) ?
It will be great if the 3 sections "description", "parameters" and "examples" were coherent

Best regards


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-15 10:25 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: Documentation problem +Package: Math related -Assigned To: +Assigned To: cmb
 [2016-08-15 10:25 UTC] cmb@php.net
Indeed, the example doesn't make sense.

mt_srand() expects an integer value[1], so basically anything
between PHP_INT_MIN and PHP_INT_MAX. However, this value will be
passed to php_mt_srand() which expects an unsigned integer, so
negative values will overflow, what doesn't appear to be a
particular issue in this case.

[1] <https://github.com/php/php-src/blob/PHP-7.0.10/ext/standard/rand.c#L244-L258>
 [2016-08-15 10:39 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=339883
Log: Fix #72830: mt_srand documentation
 [2016-08-15 10:40 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2016-08-15 10:40 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2020-02-07 06:06 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=9adde940ab0668aeaa9427ec1be8a761eb7c7f23
Log: Fix #72830: mt_srand documentation
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Feb 09 03:03:40 2023 UTC