Advertisement
Nickpips

2dice

Mar 24th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.21 KB | None | 0 0
  1. <?php
  2. $counter = 0;
  3. for( $i = 0; $i < 500; $i++ )
  4. {
  5.     $die1 = rand( 1 , 6 );
  6.     $die2 = rand( 1 , 6 );
  7.     if( $die1 + $die2 == 7 )
  8.         $counter++;
  9. }
  10. echo "You rolled a seven " . $counter . " times!";
  11. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement