Rolling a six-sided die: 2
Rolling a ten-sided die: 3
Rolling a twenty-sided die: 13
Rolling a hundred-sided die: 37
Rolling a 10,000-sided die: 89
Click to get new numbers
Code:
<html>
<head>
<title>PHP TEST YAHHH</title>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body>
<div class="topbar">
<?php
include 'navbar.php';
?>
</div>
<?php
// a few different random number generations
//
function roll ($min, $max)
{
return mt_rand($min, $max);
}
echo "Rolling a six-sided die: ";
echo roll(1, 6);
echo '<br>';
echo "Rolling a ten-sided die: ";
echo roll(1, 10);
echo '<br>';
echo "Rolling a twenty-sided die: ";
echo roll(1, 20);
echo '<br>';
echo "Rolling a hundred-sided die: ";
echo roll(1, 100);
echo '<br>';
echo "Rolling a 10,000-sided die: ";
echo roll(1, 10000);
echo '<br>';
echo '<br>';
?>
<a href="javascript:history.go(0)">Click to get new numbers</a>
<div class="codebox">
<h3>Code:</h3>
<?php
highlight_file("ex044.php");
?>
</div>
</body>
</html>