Created
April 7, 2018 00:22
-
-
Save i-Clyde/cbea0085cef71cf832f42b5ae648a7a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $nrs = range($from,$to) - There you can set the compartment of your numbers e.g. range(10,992); | |
// $from == which number will be the lowest possibility | |
// $to == which number will be the highest possibility | |
// $scope == how many numbers from ($from,$to) will be displayed | |
function rnum($scope) { | |
$nrs = range(1,70); | |
$nr = array_rand($nrs,$scope); | |
shuffle($nr); | |
for ($i=0;$i<=$ilosc-1;$i=$i+1) { | |
if($i==0) $liczby = $nrs[$nr[$i]]; | |
else $liczby = $liczby.";".$nrs[$nr[$i]]; | |
} return($liczby); | |
} | |
//Display the random numbers | |
$numbers = explode(";",rnum(5)); //Explode the numbers to get an array | |
echo $numbers[0]."<br>"; // Display the generated numbers | |
echo $numbers[1]."<br>"; | |
echo $numbers[2]."<br>"; | |
echo $numbers[3]."<br>"; | |
echo $numbers[4]."<br>"; | |
//!Warning the $scope can't be highter than the difference between $from,$to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment