Use static random fill for a fresh array and closed plain local
ProprietaryReplace a sole GetBytes(byte[]) call after an adjacent fresh byte[] allocation and parameterless BCL RNGCryptoServiceProvider plain local, in either declaration order, with typed RandomNumberGenerator.Fill. Retain allocation/consumers and leading provider comments; require exactly declaration/receiver references. Skip unknown/shared buffers, nonzero/ranged/multiple calls, explicit cleanup/escapes, other providers, internal comments, captures/ref/unsafe/async and conditional snapshots. Opt-in modern API port; no algorithm, size, seed or ownership policy choice.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseClosedPlainRandomFillmod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseClosedPlainRandomFillInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.