title: C++ loop until random generation is equal to certain number
body: <p>I am trying to do a loop that will keep looping until a generated number using srand is equal to a certain number that I want. What is the best way to go about this? I tried doing it with a do while loop but it isn't working. Example below</p>
  
  <pre><code>do{
  num = rand()%10+1;
  }while(x == 5);
  cout &lt;&lt; x;
  </code></pre>
  
  <p>The "x" number always equals to a random number but it wont always equal to 5 like how it should be in the statement</p>