|
77 | 77 |
|
78 | 78 | - The <xref:System.Random.%23ctor%28System.Int32%29> constructor uses an explicit seed value that you supply.
|
79 | 79 |
|
80 |
| -- The <xref:System.Random.%23ctor> constructor uses the system clock to provide a seed value. This is the most common way of instantiating the random number generator. |
| 80 | +- The <xref:System.Random.%23ctor> constructor uses the default seed value. This is the most common way of instantiating the random number generator. |
| 81 | + |
| 82 | + In .NET Framework, the default seed value is time-dependent. In .NET Core, the default seed value is produced by the thread-static, pseudo-random number generator. |
81 | 83 |
|
82 | 84 | If the same seed is used for separate <xref:System.Random> objects, they will generate the same series of random numbers. This can be useful for creating a test suite that processes random values, or for replaying games that derive their data from random numbers. However, note that <xref:System.Random> objects in processes running under different versions of the .NET Framework may return different series of random numbers even if they're instantiated with identical seed values.
|
83 | 85 |
|
@@ -373,13 +375,14 @@ Random.NextDouble() * (maxValue - minValue) + minValue
|
373 | 375 | </AssemblyInfo>
|
374 | 376 | <Parameters />
|
375 | 377 | <Docs>
|
376 |
| - <summary>Initializes a new instance of the <see cref="T:System.Random" /> class, using a time-dependent default seed value.</summary> |
| 378 | + <summary>Initializes a new instance of the <see cref="T:System.Random" /> class using a default seed value.</summary> |
377 | 379 | <remarks>
|
378 | 380 | <format type="text/markdown"><![CDATA[
|
379 | 381 |
|
380 | 382 | ## Remarks
|
| 383 | +In .NET Framework, the default seed value is derived from the system clock, which has finite resolution. As a result, different <xref:System.Random> objects that are created in close succession by a call to the parameterless constructor have identical default seed values and, therefore, produce identical sets of random numbers. You can avoid this problem by using a single <xref:System.Random> object to generate all random numbers. You can also work around it by generating your own random seed value and passing it to the <xref:System.Random.%23ctor%28System.Int32%29> constructor. For more information, see the <xref:System.Random.%23ctor%28System.Int32%29> constructor. |
381 | 384 |
|
382 |
| -The default seed value is derived from the system clock, which has finite resolution. As a result, on the .NET Framework only, different <xref:System.Random> objects that are created in close succession by a call to the parameterless constructor will have identical default seed values and, therefore, will produce identical sets of random numbers. This problem can be avoided by using a single <xref:System.Random> object to generate all random numbers. You can also work around it by generating your own random seed value and passing it to the <xref:System.Random.%23ctor%28System.Int32%29> constructor. For more information, see the <xref:System.Random.%23ctor%28System.Int32%29> constructor. Note that this limitation does not apply to .NET Core. |
| 385 | +In .NET Core, the default seed value is produced by the thread-static, pseudo-random number generator, so the previously described limitation does not apply. Different <xref:System.Random> objects created in close succession produce different sets of random numbers in .NET Core. |
383 | 386 |
|
384 | 387 | Call this constructor if you want your random number generator to generate a random sequence of numbers. To generate a fixed sequence of random numbers that will be the same for different random number generators, call the <xref:System.Random.%23ctor%28System.Int32%29> constructor with a fixed seed value . This <xref:System.Random> constructor overload is frequently used when testing apps that use random numbers.
|
385 | 388 |
|
|
0 commit comments