fill array with random but unique numbers in C# : <p>Okay I know there are few posts like this but I need to use only loops (for,do,while) and if, else to fill array with random but unique numbers so how shall i edit this code</p>

<pre><code>        int[] x = new int[10];
        Random r = new Random();

        int i;
        for (i = 0; i &lt; x.Length; i++) {

            x[i] = r.Next(10);
            Console.WriteLine("x[{0}] = {1}", i, x[i]);
        }
</code></pre>
