filling a array with uniqe random numbers between 0-9 in c#
<p>i want to fill my array with uniqe random numbers between 0-9 in c#
i try this function:</p>

<pre><code>IEnumerable&lt;int&gt; UniqueRandom(int minInclusive, int maxInclusive)
    {
        List&lt;int&gt; candidates = new List&lt;int&gt;();
        for (int i = minInclusive; i &lt;= maxInclusive; i++)
        {
            candidates.Add(i);
        }
        Random rnd = new Random();
        while (candidates.Count &gt; 1)
        {
            int index = rnd.Next(candidates.Count);
            yield return candidates[index];
            candidates.RemoveAt(index);
        }
    }
</code></pre>

<p>and i use it like this :</p>

<pre><code>for (int i = 0; i &lt; 3; i++)
        {
            page[i] = UniqueRandom(0, 9);
        }
</code></pre>

<p>but i got error : </p>

<pre><code>Cannot implicitly convert type 'System.Collections.Generic.IEnumerable&lt;int&gt;' to 'int'
</code></pre>

<p>i also added this name space:</p>

<pre><code>using System.Collections.Generic;
</code></pre>

<p>i just dont know how i can convert the function output to int...please help me... thank u...</p>
