Browse Source

Update SystemRandomSource.cs

Fixed a seed value issue in the .NET Framework.
pull/886/head
hikari 5 years ago
committed by GitHub
parent
commit
e293cc3f8e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/Numerics/Random/SystemRandomSource.cs

8
src/Numerics/Random/SystemRandomSource.cs

@ -51,7 +51,11 @@ namespace MathNet.Numerics.Random
/// </summary> /// </summary>
public SystemRandomSource() public SystemRandomSource()
{ {
#if NETCOREAPP
_random = new System.Random(); _random = new System.Random();
#else
_random = new System.Random(RandomSeed.Robust());
#endif
} }
/// <summary> /// <summary>
@ -60,7 +64,11 @@ namespace MathNet.Numerics.Random
/// <param name="threadSafe">if set to <c>true</c> , the class is thread safe.</param> /// <param name="threadSafe">if set to <c>true</c> , the class is thread safe.</param>
public SystemRandomSource(bool threadSafe) : base(threadSafe) public SystemRandomSource(bool threadSafe) : base(threadSafe)
{ {
#if NETCOREAPP
_random = new System.Random(); _random = new System.Random();
#else
_random = new System.Random(RandomSeed.Robust());
#endif
} }
/// <summary> /// <summary>

Loading…
Cancel
Save