Loto game in c#
<p>I m trying to make some kind of game with c#, its loto game there is 10 columns. The computer has to generate 6 numbers to fill that 10 columns, my code is like:</p>

<pre><code>public static int[] Get() 
    { 
        int[] a = new int[6];
        System.Random r = new System.Random();
        bool flag; int val; 
        for (int i = 0; i &lt; a.Length; ++i)
        {
            flag = false; 
            do 
            { 
                val = r.Next(1, 50);
                for (int k = 0; k &lt; i; ++k)     
                    if (a[k] == a[i])
                    { 
                        flag = true; 
                        break; 
                    } 
                a[i] = val; 
            } while (flag);  
        } 
        return a;
    }
    public static void Main()
    { 
        int[] a; 
        for (int i = 0; i &lt; 10; ++i) 
        { 
            a = Get();
            foreach (int x in a)  
                Console.Write("{0} ", x);
            Console.WriteLine(); 
        } 
    }
</code></pre>

<p>but it gives result same, like</p>

<pre><code>4 44 19 44 22 7
4 44 19 44 22 7
4 44 19 44 22 7
4 44 19 44 22 7
4 44 19 44 22 7
4 44 19 44 22 7
4 44 19 44 22 7
4 44 19 44 22 7
4 44 19 44 22 7
22 29 28 15 33 6
</code></pre>

<p>so whats wrong at my code.<br>
Thank you</p>
