Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Lottery number simulator - typo corrected version
- * @author Shaun B
- */
- $lotteryNumbers = Array();
- $index = 0;
- while( $index < 6 ){
- $lotteryNumbers[$index] = (rand() % 49) + 1;
- if( $index > 0 ){
- for( $i = 0; $i < $index; $i = $i + 1 ){
- while( $lotteryNumbers[$index] == $lotteryNumbers[$i] ){
- $lotteryNumbers[$index] = (rand() % 49) + 1;
- }
- }
- }
- $index = $index + 1;
- }
- foreach( $lotteryNumbers as $number){
- print( $number . PHP_EOL );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement