title: Need help understanding " rand() % 67 < 10"
body: <p>I am trying to practice my C++ in order to grasp a better understanding in class, as I am a beginner and a little behind, and I came across a zombie game that someone posted online. </p>
  
  <p>Anyways, I understand most of the code, however I do not understand "if(rand() &amp; 67 &lt; 10)".</p>
  
  <p>I can interpret "rand() % 10 + 1", in which the code will generate a number, or in this case zombies, between 1 and 10. </p>
  
  <p>Thinking at first that the zombies would cap at 67, given the player had chosen a high number, but I don't believe that is its function, but again, I'm not entirely sure...</p>
  
  <p>Here is an example of the code I am looking at:</p>
  
  <p><a href="https://i.stack.imgur.com/MzJRZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MzJRZ.png" alt="enter image description here"></a></p>
  
  <p>I'm sure its something simple, however I am still confused on its purpose. Even after trying to learn its function my running the game</p>
  
  <p>Here is the whole code just in case:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;time.h&gt;
  
  using namespace std;
  
  int createZombie() { // createZombie function OPEN
  
      if(rand() % 67 &lt; 10)
  
              return 11;
  
      else
              return rand() % 10 + 1;
  
  } // createZombie fuction CLOSED
  
  
  // #################### MAIN FUNCTION ############################
  
  
  int main() { // main function OPEN
  
  
      srand(time(NULL));
  
      char enter;
  
      // game stats
  
      int playerAlive = true;
      int playerSkill = 9;
      int playerScore = 1;
      string playerName = "";
      int zombieCount = 0;
      int zombiesKILLed = 0;
  
      // title
  
  
      cout &lt;&lt; "Welcome to Zombie War." &lt;&lt; endl &lt;&lt; "Press [ENTER] to start ";
      cin.get();
  
  
      // player name
  
      cout &lt;&lt; "Please enter your name: ";
      cin &gt;&gt; playerName;
  
      // ask how many zombies
  
      cout &lt;&lt; "How many zombies do you wish to fight? ";
      cin &gt;&gt; zombieCount;
  
  
  cout &lt;&lt;"Get ready to fight for you life, " &lt;&lt; playerName &lt;&lt; "!" &lt;&lt; endl;
  
      // main game loop
  
  
      while(playerAlive &amp;&amp; zombiesKILLed &lt; zombieCount) { // while loop OPEN
  
  
              // create a random zombie
  
              int zombieSkill = createZombie();
  
              // battle sequence 
  
              if(zombieSkill &gt; 10) { // if statment OPEN
  
  
                      cout &lt;&lt; endl &lt;&lt; "Here comes a huge zombie! " &lt;&lt; endl;
  
              } // if statement CLOSED
  
              else { // else statement OPEN
  
                      cout &lt;&lt; endl &lt;&lt; "Here comes Zombie " &lt;&lt; zombiesKILLed + 1 &lt;&lt; endl;
  
              } // else statement CLOSED
  
              cout &lt;&lt; "Fighting... " &lt;&lt; endl;
              sleep(2);
  
              // zombies killed the player
  
              if(playerSkill &lt; zombieSkill) { // if statement OPEN
  
  
                      playerAlive = false;
  
                      cout &lt;&lt; "You have died." &lt;&lt; endl;
  
              } // if statement CLOSED
  
              else { // else statment OPEN
  
                      // PLAYER KILLED THE ZOMBIE
  
                      if(playerSkill - zombieSkill &gt; 7) { // if statement OPEN
  
                              cout &lt;&lt; "You wasted the Zombie! " &lt;&lt; endl;
  
                              playerScore = playerScore * 2;
  
   } // if statment CLOSED
  
                      else if (playerSkill - zombieSkill &gt; 5) { // else if statement OPEN
  
                              cout &lt;&lt; "You decapitated the Zombie!" &lt;&lt; endl;
  
                              playerScore = playerScore * 2;
  
                      } // else if statement CLOSED
  
                      else if (playerSkill - zombieSkill &gt; 0) { // else 
  if statement OPEN
  
                              cout &lt;&lt; "You Killed the Zombie!" &lt;&lt; endl;
  
                              playerScore = playerScore * 2;
  
                      } // else if statment CLOSED
  
                      else { // else statment OPEN
  
  
                              cout &lt;&lt; "You killed the zombie, but suffered injuries." &lt;&lt; endl;
  
  
                      } // else statment CLOSED
  
                      zombiesKILLed++;
  
  
              } // else statment CLOSE
  
  
              cout &lt;&lt; endl;
              sleep(1);
  
      } // while loop CLOSED
  
  
  
      if(zombiesKILLed == zombieCount) { // if statement OPEN
  
              // victory
  
              cout &lt;&lt;"Your have survived the onslaught!" &lt;&lt; endl;
  
      } // if statement CLOSED
  
      else { // else statement OPEN
  
              // LOST
  
              cout &lt;&lt; "You did not survive the zombie war" &lt;&lt; endl;
  
      } // else statement CLOSED
  
      cout &lt;&lt; "Zombies killed: " &lt;&lt; zombiesKILLed &lt;&lt; endl;
      cout &lt;&lt; "Final score: " &lt;&lt; playerScore &lt;&lt; endl &lt;&lt; endl;
  
  
  } // main function CLOSED
  </code></pre>