diff --git a/src/libraries/System.Private.CoreLib/src/System/Random.CompatImpl.cs b/src/libraries/System.Private.CoreLib/src/System/Random.CompatImpl.cs index 1f64d8665d3b1a..645bce98764de8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Random.CompatImpl.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Random.CompatImpl.cs @@ -335,6 +335,8 @@ internal void NextBytes(Span buffer) } } + // Inlining this into hot caller loops can produce branch-heavy code that is slower than the standalone method. + [MethodImpl(MethodImplOptions.NoInlining)] internal int InternalSample() { Debug.Assert(_seedArray is not null);