Use the default RNG factory for an inline provider fill

Proprietary

Replace parameterless RNGCryptoServiceProvider construction directly consumed by byte-array GetBytes/GetNonZeroBytes with RandomNumberGenerator.Create(), preserving the overload, arguments, null failures and receiver evaluation position. Skip options, initialization, other methods, named arguments, internal constructor comments and conditional snapshots. Opt-in modern-.NET compatibility; no seed or disposal policy change. Lambda/query contexts remain unchanged.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.UseInlineRandomNumberGeneratorFactory
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.UseInlineRandomNumberGeneratorFactory

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.