1--TEST-- 2Test mt_rand() output 3--FILE-- 4<?php 5 6mt_srand(12345678, MT_RAND_PHP); 7 8for ($i=0; $i<16; $i++) { 9 echo mt_rand().PHP_EOL; 10} 11echo PHP_EOL; 12 13$x = 0; 14for ($i=0; $i<1024; $i++) { 15 $x ^= mt_rand(); 16} 17echo $x.PHP_EOL; 18echo PHP_EOL; 19 20mt_srand(12345678 /*, MT_RAND_MT19937 */); 21 22for ($i=0; $i<16; $i++) { 23 echo mt_rand().PHP_EOL; 24} 25echo PHP_EOL; 26 27$x = 0; 28for ($i=0; $i<1024; $i++) { 29 $x ^= mt_rand(); 30} 31echo $x.PHP_EOL; 32 33/* 34 * Note that the output will be different from the original mt19937ar.c, 35 * because PHP's implementation contains a bug. Thus, this test actually 36 * checks to make sure that PHP's behaviour is wrong, but consistently so. 37 */ 38 39?> 40--EXPECTF-- 41Deprecated: Constant MT_RAND_PHP is deprecated in %s on line %d 42 43Deprecated: The MT_RAND_PHP variant of Mt19937 is deprecated in %s on line %d 441614640687 451711027313 46857485497 47688176834 481386682158 49412773096 50813703253 51898651287 522087374214 531382556330 541640700129 551863374167 561324097651 571923803667 58676334965 59853386222 60 611571178311 62 63527860569 641711027313 651280820687 66688176834 67770499160 68412773096 69813703253 70898651287 7152508912 72757323740 73511765911 74274407457 75833082629 761923803667 771461450755 781301698200 79 801612214270 81