Skip to content

Commit

Permalink
Modify RAND() and RANDBETWEEN() to use mt_rand()
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkBaker committed Dec 6, 2014
1 parent ab49033 commit a4afd4d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Classes/PHPExcel/Calculation/MathTrig.php
Original file line number Diff line number Diff line change
Expand Up @@ -880,9 +880,9 @@ public static function RAND($min = 0, $max = 0) {
$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()

Expand Down
1 change: 1 addition & 0 deletions Examples/13calculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');

date_default_timezone_set('Europe/London');
mt_srand(1234567890);

/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
Expand Down
1 change: 1 addition & 0 deletions Examples/runall.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
, '11documentsecurity-xls.php'
, '12cellProtection.php'
, '13calculation.php'
, '13calculationCyclicFormulae.php'
, '14excel5.php'
, '15datavalidation.php'
, '15datavalidation-xls.php'
Expand Down

0 comments on commit a4afd4d

Please sign in to comment.