Type Reason ArgumentNullException buffer is a null reference.
Each element of the array of bytes is set to a random number greater than or equal to zero, and less than or equal to byte.MaxValue.
To generate a cryptographically secured random number suitable for creating a random password, for example, use a method such as System.Security.Cryptography.RNGCryptoServiceProvider.GetBytes(Byte[]).