public virtual ReadOnlyMemory <byte> GenerateRandomBytes(int size) { var span = new Span <byte>(new byte[size]); RandomNumberGenerator.Fill(span); return(span.AsMemory()); }
public virtual ReadOnlyMemory <byte> GenerateRandomBytes(int size) { var arr = new byte[size]; var span = new Span <byte>(arr); RandomNumberGenerator.Create().GetBytes(arr); return(span.AsMemory()); }