title: How to fill an array in multiple threads?
body: <p>There is such an array, I know what is needed through Thread, but I don’t understand how to do it. Do you need to split the array into parts, or can you do something right away?</p>
  <pre><code>Stopwatch stopWatch = new Stopwatch();
                  stopWatch.Start();
                  int[] a = new int[10000];
                  Random rand = new Random();
      
                  for (int i = 0; i &lt; a.Length; i++)
                  {
                      a[i] = rand.Next(-100, 100);
                  }
                  foreach (var p in a)
                      Console.WriteLine(p);
                  TimeSpan ts = stopWatch.Elapsed;
                  stopWatch.Stop();
                  string elapsedTime = String.Format(&quot;{0:00}:{1:00}:{2:00}.{3:00}&quot;,
                  ts.Hours, ts.Minutes, ts.Seconds,
                  ts.Milliseconds / 10);
                  Console.WriteLine(&quot;RunTime &quot; + elapsedTime);
  </code></pre>