Fills the elements of a specified array of bytes with random numbers.
Assembly: mscorlib (in mscorlib.dll)
buffer is a null reference (Nothing in Visual Basic).
Each element of the array of bytes is set to a random number greater than or equal to 0, and less than or equal to MaxValue.
For example, to generate a cryptographically secured random number suitable for creating a random password, use a method such as RNGCryptoServiceProvider.GetBytes.Notes to Inheritors
Starting with the .NET Framework version 2.0, if you derive a class from Random and override the Sample method, the distribution provided by the derived class implementation of the Sample method is not used in calls to the base class implementation of the method. Instead, the uniform distribution returned by the base Random class is used. This behavior improves the overall performance of the Random class. To modify this behavior to call the Sample method in the derived class, you must also override the method.
.NET FrameworkSupported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
.NET Framework Client ProfileSupported in: 4, 3.5 SP1
XNA FrameworkSupported in: 3.0, 2.0, 1.0
Portable Class LibrarySupported in: Portable Class Library
Supported in: Windows Phone 8.1
Supported in: Windows Phone Silverlight 8.1
Supported in: Windows Phone Silverlight 8