Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Fills the elements of a specified array of bytes with random numbers.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Overridable Sub NextBytes ( _
buffer As Byte() _
)
public virtual void NextBytes(
byte[] buffer
)
public:
virtual void NextBytes(
array<unsigned char>^ buffer
)
abstract NextBytes :
buffer:byte[] -> unit
override NextBytes :
buffer:byte[] -> unit
public function NextBytes(
buffer : byte[]
)
Parameters
- buffer
Type: array<System. . :: . .Byte> [] () [] []
An array of bytes to contain random numbers.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | buffer is null Nothing nullptr unit a null reference (Nothing in Visual Basic) . |
Remarks
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 MaxValue.
To generate a cryptographically secured random number suitable for creating a random password, for example, use a method such as RNGCryptoServiceProvider..::..GetBytes.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.