Rename Random.LegacyImpl (#50456)
authorStephen Toub <stoub@microsoft.com>
Wed, 31 Mar 2021 07:23:25 +0000 (03:23 -0400)
committerGitHub <noreply@github.com>
Wed, 31 Mar 2021 07:23:25 +0000 (09:23 +0200)
To be more specific about what it is.

src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
src/libraries/System.Private.CoreLib/src/System/Random.Net5CompatImpl.cs [moved from src/libraries/System.Private.CoreLib/src/System/Random.LegacyImpl.cs with 97% similarity]
src/libraries/System.Private.CoreLib/src/System/Random.cs

index 4e86ee4..59c4365 100644 (file)
     <Compile Include="$(MSBuildThisFileDirectory)System\Progress.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Random.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Random.ImplBase.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)System\Random.LegacyImpl.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\Random.Net5CompatImpl.cs" />
     <Compile Condition="'$(Is64Bit)' != 'true'" Include="$(MSBuildThisFileDirectory)System\Random.Xoshiro128StarStarImpl.cs" />
     <Compile Condition="'$(Is64Bit)' == 'true'" Include="$(MSBuildThisFileDirectory)System\Random.Xoshiro256StarStarImpl.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Range.cs" />
@@ -16,7 +16,7 @@ namespace System
         /// of Knuth's subtractive random number generator algorithm.  See https://github.com/dotnet/runtime/issues/23198
         /// for a discussion of some of the modifications / discrepancies.
         /// </summary>
-        private sealed class LegacyImpl : ImplBase
+        private sealed class Net5CompatImpl : ImplBase
         {
             /// <summary>Thread-static instance used to seed any legacy implementations created with the default ctor.</summary>
             [ThreadStatic]
@@ -29,11 +29,11 @@ namespace System
             private int _inext;
             private int _inextp;
 
-            public LegacyImpl(Random parent) : this(parent, (t_seedGenerator ??= new()).Next())
+            public Net5CompatImpl(Random parent) : this(parent, (t_seedGenerator ??= new()).Next())
             {
             }
 
-            public LegacyImpl(Random parent, int Seed)
+            public Net5CompatImpl(Random parent, int Seed)
             {
                 _parent = parent;
 
index daaa02e..f725b4c 100644 (file)
@@ -24,7 +24,7 @@ namespace System
             // With no seed specified, if this is the base type, we can implement this however we like.
             // If it's a derived type, for compat we respect the previous implementation, so that overrides
             // are called as they were previously.
-            _impl = GetType() == typeof(Random) ? new XoshiroImpl() : new LegacyImpl(this);
+            _impl = GetType() == typeof(Random) ? new XoshiroImpl() : new Net5CompatImpl(this);
 
         /// <summary>Initializes a new instance of the Random class, using the specified seed value.</summary>
         /// <param name="Seed">
@@ -34,7 +34,7 @@ namespace System
         public Random(int Seed) =>
             // With a custom seed, for compat we respect the previous implementation so that the same sequence
             // previously output continues to be output.
-            _impl = new LegacyImpl(this, Seed);
+            _impl = new Net5CompatImpl(this, Seed);
 
         /// <summary>Returns a non-negative random integer.</summary>
         /// <returns>A 32-bit signed integer that is greater than or equal to 0 and less than <see cref="int.MaxValue"/>.</returns>