znalazłem w internecie taki o to generator liczb.
Chciał bym żeby nie pokazywało liczb po przecinku, jak to zrobić.
Proszę o pomoc.
<?php if (!$_POST['submit']) { //form not submitted, display form ?> <form action="<?php echo $SERVER['PHP_SELF']; ?>" method="post"> <br /> This is a DECIMAL random number generator that generates numbers specified by minimum and maximum value.<br /> For example you would like to generate random numbers between 99.75 and 100.25<br /> Example of this generated decimal random number will be 99.85. 100.21, 100.01, 99.98 etc. <br /> All you need is to specify how many random numbers you need, then also the range eg. minimum and maximum values. Fill up the form and <br /> tool will automatically produce the numbers to you. <br /> This tool may contain repeated numbers and if you like uniquely produced numbers, I will create one in the future. <br /> However you can use Excel to provide unique filtering of the produced set of random numbers. <br /> This tool will give two decimal places of the result. <br /><br /> Given: <br /> Wpisz ile liczb ma się pokazać <input type="text" name="amount" size="10"> <br /> <br /> Wpisz maksymalną wartość liczby: <input type="text" name="max" size="10"> <br /> <br /> Wpisz minimalną wartość liczby: <input type="text" name="min" size="10"> <br /> <br /> <input type="submit" name="submit" value="Generuj!"> </form> <br /> <br /> <br /> To narzędzie zostało stworzone przez: <a href="link">.....</a> <br /> <?php } else { //form submitted, grab the data from POST $amount =trim($_POST['amount']); $max =trim($_POST['max']); $min =trim($_POST['min']); //test if it contains some data. if (((isset($amount)) && !(trim($amount) == "") && !(trim($max) == "") && !(trim($min) == "")) && ((is_numeric($amount)) && (is_numeric($max)) && (is_numeric($min)) && ($max > $min))) { //form input is either not empty and is numeric, process values echo '<h2>Below are the generated decimal random numbers:</h2><br /><br />'; $maxadjusted = $max * 100; $minadjusted = $min * 100; $i = 1; while ($i <= $amount) { $random =mt_rand($minadjusted,$maxadjusted); $number =1* $random; $i++; echo round($number,2); echo '<br />'; } echo '<br />'; echo '<br />'; echo 'You have set max value to: '.$max; echo '<br />'; echo 'You have set min value to: '.$min; echo '<br />'; echo 'Amount of random numbers generated: '.$amount; echo '<br />'; echo '<br />'; echo '<a href="/decimalrandomnumbergenerator.php">Try again this tool</a><br />'; } else { //something is wrong with the inputted data echo 'Please double check inputted data, it seems you either enter a blank data, wrong captcha, inputted a non-numeric value or inputted a value in a maximum field but is actually a minimum than your minimum set value.'; echo '<br />'; echo '<a href="/decimalrandomnumbergenerator.php">Click here to input data again.</a>'; } } ?>