title: How to generate random number from a given set of values?
body: <pre><code>int main()
  {
      srand(time(NULL));
      int r=rand();
  }
  </code></pre>
  
  <p>The above function can generate any number, but what if I want to generate a number from a given set of values.<br>
  For example if I want to generate a number randomly but ONLY from the values <code>4,6,1,7,8,3</code>.<br>
  Is there any way to achieve this?</p>
  
  <p>Any help would be appreciated.</p>