Created
April 30, 2015 21:07
-
-
Save kojiromike/63bef5e84dac549d1670 to your computer and use it in GitHub Desktop.
BogoBuzz: FizzBuzz, but even dumber
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
<?php | |
/** | |
* BogoBuzz | |
* | |
* FizzBuzz, but randomly | |
*/ | |
$seen = []; | |
while (count($seen) !== 100) { | |
$i = rand(1, 100); | |
if (isset($seen[$i])) continue; | |
$seen[$i] = 1; | |
if ($i % 3 === 0) { | |
echo 'Fizz'; | |
} | |
if ($i % 5 === 0) { | |
echo 'Buzz'; | |
} | |
if ($i % 5 && $i % 3) { | |
echo $i; | |
} | |
echo "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment