title: Generating an Odd Random Number between a given Range
body: <p>How to generate an odd Random number between a given range..</p>
  
  <p>For Eg: For range between 1 to 6 .. 
  Random No is 3 or 1 or 5</p>
  
  <p>Method for Generating Random No :</p>
  
  <pre><code>    Random_No = Min + (int)(Math.Random()*((Max-Min)+1))
  </code></pre>
  
  <p>Refer <a href="https://stackoverflow.com/questions/363681/generating-random-number-in-a-range-with-java">How do I generate random integers within a specific range in Java?</a></p>
  
  <p>Method For Generating Odd Random No :</p>
  
  <pre><code>    Random_No = Min + (int)(Math.Random()*((Max-Min)+1))
      if(Random_No%2 ==0)
      {
            if((Max%2)==0)&amp;&amp;Random_No==Max)
            {
                Random_No = Random_No - 1;  
            }
            else{
                Random_No = Random_No +1;
            }
      }
  </code></pre>
  
  <p>This Function will always convert 2 into 3 and not 1 
  Can we make this a more random function which can convert 2 sometimes into 3 and sometimes into 1 ??</p>