From a4afd4d31383db6a070ec10c7559d14688989aba Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sat, 6 Dec 2014 00:16:09 +0000 Subject: [PATCH] Modify RAND() and RANDBETWEEN() to use mt_rand() --- Classes/PHPExcel/Calculation/MathTrig.php | 4 ++-- Examples/13calculation.php | 1 + Examples/runall.php | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Classes/PHPExcel/Calculation/MathTrig.php b/Classes/PHPExcel/Calculation/MathTrig.php index b2bb19d..9f0e7f4 100644 --- a/Classes/PHPExcel/Calculation/MathTrig.php +++ b/Classes/PHPExcel/Calculation/MathTrig.php @@ -880,9 +880,9 @@ class PHPExcel_Calculation_MathTrig { $max = PHPExcel_Calculation_Functions::flattenSingleValue($max); if ($min == 0 && $max == 0) { - return (rand(0,10000000)) / 10000000; + return (mt_rand(0,10000000)) / 10000000; } else { - return rand($min, $max); + return mt_rand($min, $max); } } // function RAND() diff --git a/Examples/13calculation.php b/Examples/13calculation.php index db14948..01e63ea 100644 --- a/Examples/13calculation.php +++ b/Examples/13calculation.php @@ -34,6 +34,7 @@ date_default_timezone_set('Europe/London'); define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); date_default_timezone_set('Europe/London'); +mt_srand(1234567890); /** Include PHPExcel */ require_once dirname(__FILE__) . '/../Classes/PHPExcel.php'; diff --git a/Examples/runall.php b/Examples/runall.php index c65727e..3818547 100644 --- a/Examples/runall.php +++ b/Examples/runall.php @@ -59,6 +59,7 @@ $aTests = array( , '11documentsecurity-xls.php' , '12cellProtection.php' , '13calculation.php' + , '13calculationCyclicFormulae.php' , '14excel5.php' , '15datavalidation.php' , '15datavalidation-xls.php'