RandomNumberGenerator::GetBytes Method (array<Byte>^, Int32, Int32)

.NET Framework (current version)
 

Fills the specified byte array with a cryptographically strong random sequence of values.

Namespace:   System.Security.Cryptography
Assembly:  mscorlib (in mscorlib.dll)

public:
virtual void GetBytes(
	array<unsigned char>^ data,
	int offset,
	int count
)

Parameters

data
Type: array<System::Byte>^

The array to fill with cryptographically strong random bytes.

offset
Type: System::Int32

The index of the array to start the fill operation.

count
Type: System::Int32

The number of bytes to fill.

Exception Condition
ArgumentNullException

data is null.

ArgumentOutOfRangeException

offset or count is less than 0

ArgumentException

offset plus count exceeds the length of data.

.NET Framework
Available since 4.6
Return to top
Show: