PHP/Math/Random

Материал из Web эксперт
Перейти к: навигация, поиск

mt_rand with no arguments

<?
print("Seeding the generator<BR>");
mt_srand((double)microtime() * 1000000);
print("With no arguments: " . mt_rand() . "<BR>");
print("With no arguments: " . mt_rand() . "<BR>");
print("With no arguments: " . mt_rand() . "<BR>");
?>



mt_rand with two arguments

<?
print("Seeding the generator<BR>");
mt_srand((double)microtime() * 1000000);

print("With two arguments: " .mt_rand(27, 31) . "<BR>");
print("With two arguments: " .mt_rand(27, 31) . "<BR>");
print("With two arguments: " .mt_rand(27, 31) . "<BR>");
?>