diff --git a/functions/math.xml b/functions/math.xml index fe301e4377..1975acc367 100644 --- a/functions/math.xml +++ b/functions/math.xml @@ -1,5 +1,5 @@ - + Mathematical Functions Math @@ -794,8 +794,12 @@ var_dump(hexdec("a0")); seed. -// seed with microseconds since last "whole" second -mt_srand ((float) microtime() * 1000000); +// seed with microseconds +function make_seed() { + list($usec,$sec) = explode(" ", microtime()); + return ((double)$sec+(double)$usec) * 100000; +} +mt_srand(make_seed()); $randval = mt_rand(); @@ -1223,8 +1227,12 @@ $foo = round(1241757, -3); // $foo == 1242000 seed. -// seed with microseconds since last "whole" second -srand ((float) microtime() * 1000000); +// seed with microseconds +function make_seed() { + list($usec,$sec) = explode(" ", microtime()); + return ((double)$sec+(double)$usec) * 100000; +} +srand(make_seed()); $randval = rand();