Random numbers every .Next() call [ Multiple .Next() in method]
<p>I have a problem with random number generating in C#</p>

<p>I have tried all the solutions that I've found. Most we're only using the same random object every time which works only each object, not each property.</p>

<p>So I am using this as code for the random numbers:</p>

<pre><code>private static readonly Random random = new Random();
private static readonly object syncLock = new object();

public static int RandomNumber(int min, int max)
{
            lock (syncLock)
            { // synchronize
                return random.Next(min, max);
            }
}
</code></pre>

<p>Now I want to call <code>.Next()</code> multiple times in the same method, to generate a random object:</p>

<pre><code>public void StartDuiven()
{
   for (int i = 0; i &lt;= 6; i++)
   {
      var d = new Duif();
      d.Naam = /*NameGenerator.GenRandomFirstName() +" "+ NameGenerator.GenRandomLastName()*/ "Jantje";
      d.GeboorteDatum = DateTime.Now;
      d.Snelheid = Genrator.RandomNumber(0, 4);
      d.Vliegtechniek = Genrator.RandomNumber(0, 4);
      d.Vormpeil = Genrator.RandomNumber(0, 4);
      d.Conditie = Genrator.RandomNumber(0, 4);
      d.Aerodynamica = Genrator.RandomNumber(0, 4);
      d.Intelligentie = Genrator.RandomNumber(0, 4);
      d.Libido = Genrator.RandomNumber(0, 4);
      d.Nachtvliegen = Genrator.RandomNumber(0, 4);
      d.Navigatie = Genrator.RandomNumber(0, 4);
      d.Ervaring = Genrator.RandomNumber(0, 4);
      d.Transfer = false;

      int g = Genrator.RandomNumber(0, 2); // Edited

      if (g == 0)
         d.Geslacht = false;
      else
         d.Geslacht = true;

      AddDuif(d);
   }
}
</code></pre>

<p>Every new object I get a different number, but not every time I call .<code>Next()</code> method.</p>

<p>So all the values of the properties become the same for 1 object.</p>

<p>How could I fix this? Why don't I get a new value on each <code>.Next()</code> call?</p>

<p>Thank you</p>

<p>Bye!</p>
