I basically have a HTML form where the user inputs the number of random numbers to be generated and their range. The problem is, every time I try to generate a random set of numbers, I get $count
times $max
displayed.
This is the PHP code:
<?php
$count=$_GET['count'];
$min=$_GET['max'];
$max=$_GET['max'];
$i=0;
while ($i<$count) {
echo rand($min,$max) . '<br />';
$i++;
}
?>
<?php
$count=$_GET['count'];
$min=$_GET['min'];
$max=$_GET['max'];
$i=0;
while ($i<$count) {
echo rand($min,$max) . '<br />';
$i++;
}
?>
You are setting $min
and $max
both to you $_GET['max']
value
Your $min and $max are both set to $_GET['max'] ...