Use static random fill for a fresh array and closed provider

Proprietary

Replace a sole GetBytes(byte[]) call in a parameterless RNGCryptoServiceProvider using statement immediately after a fresh byte[] local allocation with RandomNumberGenerator.Fill. Retain the original array/allocation, buffer identity and surrounding code. Skip nonzero/ranged fills, unknown or shared buffers, other providers/factories, comments, initializers, captures/ref/unsafe/async and conditional snapshots. Opt-in modern-.NET port; no seed, algorithm or key policy is selected.

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

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