Bug #60543 [Dup]: mt_rand() only reliable when ($max - $min) <= mt_getrandmax ()

From: Date: Sat, 15 Aug 2015 10:23:49 +0000
Subject: Bug #60543 [Dup]: mt_rand() only reliable when ($max - $min) <= mt_getrandmax ()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195226@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60543&edit=1 ID: 60543 Updated by: cmb@php.net Reported by: daniel at danielnorton dot com Summary: mt_rand() only reliable when ($max - $min) <= mt_getrandmax () Status: Duplicate Type: Bug Package: Math related Operating System: Windows PHP Version: 5.3.8 Assigned To: cmb Block user comment: N Private report: N New Comment: Oops, I meant bug #63174. Previous Comments: ------------------------------------------------------------------------ [2015-08-15 10:22:54] cmb@php.net Related To: Bug #60543 ------------------------------------------------------------------------ [2015-08-15 10:22:53] cmb@php.net This issue has the same cause as bug #60543. As the other ticket is already being worked on (PR #1416), I'm marking this one as duplicate. ------------------------------------------------------------------------ [2014-07-31 04:01:12] datibbaw@php.net Can't test this on Windows, but according to 3v4l it can't be reproduced in any of the versions: http://3v4l.org/anJ6F ------------------------------------------------------------------------ [2011-12-16 07:14:09] daniel at danielnorton dot com I suggest changing the title of this to "mt_rand() only reliable when ($max - $min) <= mt_getrandmax ()". ------------------------------------------------------------------------ [2011-12-16 06:18:19] daniel at danielnorton dot com The problem does not appear if ($max - $min) <= PHP_INT_MAX. Perhaps this is a documentation problem and the solution might simply be to specify that ($max - $min) must be less than mt_getrandmax()? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=60543 -- Edit this bug report at https://bugs.php.net/bug.php?id=60543&edit=1

« previous php.bugs (#195226) next »