From df74b236f7e1d3bda29b158e19afdc087e78ee49 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Mon, 11 Dec 2006 21:05:14 +0000 Subject: [PATCH] Fix #8121 : wfRandom() is not between 0 and 1 --- RELEASE-NOTES | 1 + includes/GlobalFunctions.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a8de8927b9..d687621555 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -269,6 +269,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Special:AllPages : 'next page' link now point to the first title of the next chunk instead of pointing to the last title of current chunk. * (bug 4673) Special:AllPages : add a 'previous' link (new message 'prevpage') +* (bug 8121) wfRandom() was not between 0 and 1 == Languages updated == diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 15f3912452..db05e084db 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -114,7 +114,7 @@ function wfSeedRandom() { function wfRandom() { # The maximum random value is "only" 2^31-1, so get two random # values to reduce the chance of dupes - $max = mt_getrandmax(); + $max = mt_getrandmax() + 1; $rand = number_format( (mt_rand() * $max + mt_rand()) / $max / $max, 12, '.', '' ); return $rand; -- 2.20.1