|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-02-08 20:36 UTC] burg1 at gmx dot net
Description: ------------ I'm suggestion to revise this sentence in the docs: "If you require a range larger than 32768, specifying min and max will allow you to create a range larger than RAND_MAX, or consider using mt_rand() instead." 1) As far as I can see, the max parameter cannot be larger than getrandmax(), otherwise rand() always returns 0. Please mention this limit! (I'm not sure if this behavior is platform-depended or due to PHP-internal integer handling, so I cannot suggest a reformulation.) 2) As far as I can see, this limit also applies to mt_rand(), so the last subsentence "or consider using mt_rand() instead" doesn't make sense to me. 3) Since mt_rand generates a "better random value", please include an explicit Note about this fact. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 17:00:01 2025 UTC |
3) Yes, but maybe you could state explicitly that mt_rand() "generates a better random value". Currently, the first link ("If you require a range larger...") misses this point and the second link ("See also") is too unspecific.