title: Given a function rand7(), write a function which rand10() uniformly
body: <p>Can i have an efficient solution for the above problem.... I tried to figure out the problem from this website <a href="http://www.ihas1337code.com/2010/11/rejection-sampling.html" rel="nofollow">http://www.ihas1337code.com/2010/11/rejection-sampling.html</a>
  but couldn't get the reason 
  idx = col + (row-1)*7; why are they multiplying with 7....  </p>
  
  <p>we could have done this also (rand7() * rand7()) % 10... or multiplying with any other number, because at the end we have to do mod 10 which will give the results within 10 only....</p>
  
  <p>why they have made the solution so difficult.. Please explain and your thoughts on it...</p>
  
  <p>And what does uniformly means in the question?</p>
  
  <p>Thanks..</p>