 <p>How about using a utility enumerable method:</p> <pre><code> static IEnumerable&lt;int&gt; RandomNumbersBetween(int min, int max) { int availableNumbers = (max - min) + 1 ; int yieldedNumbers = 0; Random rand = new Random(); Dictionary&lt;int, object&gt; used = new Dictionary&lt;int, object&gt;(); while (true) { int n = rand.Next(min, max+1); //Random.Next max value is exclusive, so add one if (!used.ContainsKey(n)) { yield return n; used.Add(n, null); if (++yieldedNumbers == availableNumbers) yield break; } } } </code></pre> <p>Because it returns IEnumerable, you can use it with LINQ and IEnumerable extension methods:</p> <pre><code>RandomNumbersBetween(0, 20).Take(10) </code></pre> <p>Or maybe take odd numbers only:</p> <pre><code>RandomNumbersBetween(1, 1000).Where(i =&gt; i%2 == 1).Take(100) </code></pre> <p>Et cetera.</p> <p><strong>Edit:</strong></p> <p>Note that this solution has terrible performance characteristics if you are trying to generate a full set of random numbers between <code>min</code> and <code>max</code>. </p> <p>However it works efficiently if you want to generate, say 10 random numbers between 0 and 20, or even better, between 0 and 1000.</p> <p>In worst-case scenario it can also take <code>(max - min)</code> space.</p>