title: How to omit some numbers from rand() function's range?
body: <p>I need to use <code>rand()</code> function to get numbers between 1-15, so I simply used the function as below.</p>
  
  <pre><code>num1 = rand()%15+1;
  </code></pre>
  
  <p>But between this 1-15 range, there are some numbers that I want to prevent from being assigned into <code>num1</code> variable.</p>
  
  <p>I thought about putting an <code>if-else</code> function there, as the <code>rand()</code> function would repeat itself on such occasion that an undesired number turned up.</p>
  
  <p>However, what I'm most curious is whether there is a more effective way to omit these undesired numbers from <code>rand()</code> function's range.</p>
  
  <p>Thank you so much!</p>