title: How can i choose random number smaller than "1000" or "n" in vb?
body: <p>How can i choose random number smaller than "1000" or "n"?</p>
  
  <pre><code>Do While ddd &lt;&gt; 1
      Static staticRandomGenerator As New System.Random
  
      max += 1
      dd = staticRandomGenerator.Next(If(min &gt; max, max, min), If(n &gt; max, min, max))
      ddd = ee * dd Mod z
  Loop
  </code></pre>
  
  <p>How can i add this condition to this code? Any idea?</p>