Created
December 15, 2020 13:15
-
-
Save thistehneisen/50579a0dd6f396f0aec2eed1d49d1a9c to your computer and use it in GitHub Desktop.
Lottery Number Generator (6/49) - generate 6 random numbers in the range 1 - 49 inclusive
This file contains hidden or 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
<?php | |
function lottery649($maxn = "49",$maxb="6") { | |
srand((double)microtime() * 1000000); | |
while (1>0) { | |
$lottery[] = rand(1,$maxn); | |
$lottery = array_unique($lottery); | |
if (sizeof($lottery) == $maxb) break; | |
} | |
sort($lottery); | |
return implode(", ",$lottery); | |
} | |
$lottery649 = lottery649(); | |
print($lottery649); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment