Fix #8121 : wfRandom() is not between 0 and 1
authorAntoine Musso <hashar@users.mediawiki.org>
Mon, 11 Dec 2006 21:05:14 +0000 (21:05 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Mon, 11 Dec 2006 21:05:14 +0000 (21:05 +0000)
RELEASE-NOTES
includes/GlobalFunctions.php

index a8de892..d687621 100644 (file)
@@ -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 ==
 
index 15f3912..db05e08 100644 (file)
@@ -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;