使用PHP 实现Java System.currentTimeMillis() * Math.random()

class Untitled {
	public static void main(String[] args) {
		System.out.println(System.currentTimeMillis() * Math.random());
	}
}
//1.234935351027602E12
 function random($min = 0, $max = 1)
 {
     return (float)$min + mt_rand()/mt_getrandmax()*($max-$min);
 }
 list($msec, $sec) = explode('.', microtime(true));
 echo (($msec.$sec.mt_rand(1000,9999)) * random());
 #1.4095144256067E+17

       

你可能感兴趣的:(php)