title: create a random number less than a max given value
body: <p>What i would love to do is to create a function that takes a parameter that is the limit of which number the random generation should create. I have experienced that some generators that just repeat the number generated over and over again. </p>
  
  <p>How can I make a generator that doesn't return the same number consecutively. Can someone please help me to achieve my goal?</p>
  
  <pre><code>int randomGen(int max)
  {
    int n;      
    return n;
  }
  </code></pre>