Array 2 method random generated number
<p>For a part of a program i need the following 2 methods.</p>

<p>The first method listed will generated a random number.
where the 2nd method will "call" this method to fill the array.</p>

<p>The array has a max. number of elements defefined on 100 (and all the random generated numbers should be between 1-100).</p>

<p>The problem is i never get random numbers generated. (either i get 100 x the same value, 3 random numbers divided over the 100 max. elements of the array,  or the same value 100 times all over again).</p>

<p>The problem should be in the first method, but i cannot seem to figure out the problem.
Been staring at this for quite some time now...</p>

<p>The problem should be with the return, cause it DOES create random generated numbers. But how do i return the generated value every time? (the int method has to be called with the 3 parameters).</p>

<pre><code>        private int ValidNumber(int[] T, int X, int Range)
    {
        for (byte I = 0; I &lt; T.Lenght; I++)
        {
            Random RndInt = new Random();
            X = RndInt.Next(1, Range+1);
        }
        return X; 

    }/*ValidNumber*/


  public void FillArray(int[] T, int Range)
    {
        for (byte I = 0; I &lt; T.Length; I++)
        {
            T[I] = ValidNumber(T, I, Range);
        }

    }/*FillArray*/
</code></pre>

<p>Console code:</p>

<pre><code>public void ExecuteProgram()
    {
        ClsBereken Ber = new ClsBereken();

        //const byte Range = 100;
        const int Max = 100;
        int[] T = new int[Max];

        Ber.FillArray(T, Max);
        DisplayArray(T);

    }/*ExecuteProgram*/

    private void DisplayArray(int[] T)
    {
        for (byte i = 0; i &lt; T.Length; i++)
        {
            Console.Write("{0,4} ", T[i]);
        }
        Console.WriteLine();
    }/*DisplayArray*/
</code></pre>

<p>Any help alot appreciated.
Kind Regards.</p>
